Object.GetType Method ()
Gets the Type of the current instance.
Assembly: mscorlib (in mscorlib.dll)
For two objects x and y that have identical runtime types, Object.ReferenceEquals(x.GetType(),y.GetType()) returns true. The following example uses the method with the ReferenceEquals method to determine whether one numeric value is the same type as two other numeric values.
To determine whether an object is a specific type, you can use your language's type comparison keyword or construct. For example, you can use the TypeOf…Is construct in Visual Basic or the is keyword in C#.
The Object. This means that, in addition to using your own language's comparison keyword, you can use the method to determine the type of a particular object, as the following example shows.method is inherited by all types that derive from
Available since 4.5
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1