typeof keyword takes the Type itself as an argument and returns the underline Type of the argument whereas GetType() can only be invoked on the instance of the type.
typeof
System.Type t1= typeof(Employee); // Employee is a Type
GetType()
Employee employee= new Employee();
System.Type t2= employee.GetType(); // employee is an instance of the type Employee.
Happy Coding!!!
typeof
System.Type t1= typeof(Employee); // Employee is a Type
GetType()
Employee employee= new Employee();
System.Type t2= employee.GetType(); // employee is an instance of the type Employee.
Happy Coding!!!
No comments:
Post a Comment