I master C # and got a little confused with the cast mechanism.
internal class Employee{ } internal class ExtendedEmployee : Employee{ } class Program { static void Main(string[] args) { ExtendedEmployee exE = new ExtendedEmployee(); Employee e = exE as Employee; Console.WriteLine(e.GetType()); } }
Logically, it should return the type Employee
, however, it deduces that the type is ExtendedEmployee
. What did I understand wrong? Explicit cast ( Employee
) too