Sunday, 23 September 2018

Difference Between Typeof and GetType() Methods

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!!!

No comments:

Post a Comment

SQL Audits

1. sys.server_audits What it is: Lists all server-level audit objects . An audit is the top-level object that defines: Where to wri...