What is the difference between TypeOf and GetType?

Answer Posted / chirag

GetType is a call that is made at runtime on an instance of
an object.
typeof() is resolved to a call at runtime, but loads the
type from the token
for the type. They probably resolve to the same call, it's
just that
GetType requires an instance. If I didn't need the instance,
I would use
typeof.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can abstract class have constructor?

502


What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?

523


what is a constructor? What is a destructor?

526


What is xaml in c#?

505


Difference between value and reference type.

513






What is the different types of private assembly and shared assembly?

504


Why dictionary is used in c#?

546


What is dynamic in c#?

469


Define mutex in C#?

617


What is a multicast c# delegate?

518


Which controls do not have events?

560


What is iqueryable and ienumerable in c#?

513


What is datarelation c#?

465


Does main have to be static c#?

490


What is cache memory in c#?

492