Object.GetType Method is used to find the type of the current instance. This method returns the instances of the Type class that are used for consideration.
public Type GetType ();
Return Value: This method return the exact runtime type of the current instance.
Below given are some examples to understand the implementation in a better way:
Type of str1: System.String Type of str2: System.String
Str 1 is : C# Str 2 is : DSA Str 3 is : 43 Is Str 1 and Str 2 of same type? : True Is Str 2 and Str 3 of same type? : False Is Str 3 and Str 2 of same type? : False
- C# | Copying the HybridDictionary entries to an Array Instance
- C# | Copy ListDictionary to Array instance at the specified index
- C# | Copying the Hashtable elements to an Array Instance
- C# | Copy OrderedDictionary elements to Array instance at the specified index
- C# | Type.IsAssignableFrom(Type) Method
- C# | How to check current state of a thread
- C# | Getting the unique identifier for the current managed thread
- How to display Current Date/Time in the DateTimePicker in C#?
- Suspending the current thread for the specified amount of time in C#
- C# | Converting an array of one type to an array of another type
- Naming a thread and fetching name of current thread in C#
- Dynamic Type in C#
- C# | Type Casting
- C# | Type.GetEnumUnderlyingType() Method
- C# | Type.GetInterface() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.