VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-object-gettypecode-method-with-examples/

⇱ C# | Object.GetTypeCode() Method with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | Object.GetTypeCode() Method with Examples

Last Updated : 11 Jul, 2025
This method is used to return the Type of the current instance. Here, Type Represents type declarations i.e. class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types. The System.Object class is the base class for all the types which are present in the .NET Framework type system. Basically, this method returns the Type objects that represent all .NET Framework types. The .NET Framework recognizes the following five categories of types: Syntax:
public Type GetType ();
Return Value: This method returns the run-time type of the current instance. Below programs illustrate the use of Object.GetType() Method: Example 1:
Output:
The X class object type is: X
The G class object type is: G
The obj2 object type is: X
Example 2:
Output:
Author details:
Author Name : Kirti
Article Name : GetType() method
Article No : 3
Type of Author Name : System.String
Type of Article Name : System.String
Type of Article No : System.Int32
Type of Author class object: Author
Reference: https://learn.microsoft.com/en-us/dotnet/api/system.object.gettype?view=netframework-4.7.2
Comment
Article Tags:

Explore