Difference between GetType() and typeof() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Difference between GetType() and typeof()

Why provide Microsoft two different methods for single work

1st Apr 2020, 9:44 AM
Shashank Mishra
Shashank Mishra - avatar
2 Answers
0
First of all, Typeof is not a function. It is a keyword which is used to define the type. While GetType() is used to get the datatype of a particular object. It can be used only on the object of a class. For further learning, you can refer the following link. https://www.c-sharpcorner.com/blogs/difference-between-typeof-and-gettype-methods1
2nd Apr 2020, 5:51 AM
Ishan Shah
Ishan Shah - avatar