Gettype () and typeof () differences
When comparing objects, you need to know their types to determine whether their values can be compared. All classes inherit the GetType () method from System.Object and are often used with the TYPEO () operator.
Both return a reference to the Syetem.type.
So it is necessary to differentiate between the two:
1.Gettype () is a method inherited from System.Object that returns the type of the current object of type types; typeof (XX) is an operator, XX must be a specific class name, type name, etc., and cannot be a variable name.
2.Gettype () must be created for specific objects (instances) to be used,
The parameters of 3.typeof () can only be int,string types and custom types, and cannot be instances.
4.Gettype returns the type (type) of the instance, and TypeOf returns the Class (classes).
C # Methods--gettype () and typeof () differences