C# | Type.GetElementType() Method Last Updated : 09 May, 2019 Comments Improve Suggest changes Like Article Like Report Type.GetElementType() Method is used to return the Type of the object encompassed or referred to by the current array, pointer or reference type when overridden in a derived class. Syntax: public abstract Type GetElementType (); Return Value: This method returns the Type of the object encompassed or referred to by the current array, pointer, or reference type, or null if the current Type is not an array or a pointer, or is not passed by reference, or represents a generic type or a type parameter in the definition of a generic type or generic method. Below programs illustrate the use of Type.GetElementType() Method: Example 1: csharp // C# program to demonstrate the // Type.GetElementType() Method using System; using System.Globalization; using System.Reflection; class GFG { // Main Method public static void Main() { // Declaring and initializing type Type type = typeof(int[,, ]); // using GetElementType() Method Type t = type.GetElementType(); // Display the ElementType Console.WriteLine("ElementType is: {0}", t); } } Output: ElementType is: System.Int32 Example 2: csharp // C# program to demonstrate the // Type.GetElementType() Method using System; using System.Globalization; using System.Reflection; class GFG { // Main Method public static void Main() { // Creating the object of class GFG obj = new GFG(); Type typ1 = obj.GetType(); Type typ2 = typ1.GetElementType(); Console.WriteLine("Element type of {0} is {1}", obj, typ2==null? "null" : typ2.ToString()); } } Output: Element type of GFG is null Reference: https://docs.microsoft.com/en-us/dotnet/api/system.type.getelementtype?view=netframework-4.8 Comment More infoAdvertise with us Next Article C# | Type.GetElementType() Method rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Type-Class Similar Reads C# | Type.GetNestedType() Method Type.GetNestedType() Method is used to get a specific type nested within the current Type. There are 2 methods in the overload list of this method as follows: GetNestedType(String, BindingFlags) Method GetNestedType(String) Method GetNestedType(String, BindingFlags) Method This method is used to sea 4 min read C# | Type.HasElementTypeImpl() Method Type.HasElementTypeImpl() Method is used when overridden in a derived class, implementing the HasElementType property and determines whether the current Type encompasses or refers to another type. It means this method checks whether the current Type is an array, a pointer, or is passed by reference. 3 min read C# | Type.GetNestedTypes() Method Type.GetNestedTypes() Method is used to get the types nested within the current Type. There are 2 methods in the overload list of this method as follows: GetNestedTypes() Method This method is used to return the public types nested in the current Type. Syntax: public Type[] GetNestedTypes ();Return 5 min read C# | Type.GetTypeCode() Method Type.GetTypeCode() Method is used to get the underlying type code of the specified Type. Syntax: public static TypeCode GetTypeCode (Type type); Here, it takes the type whose underlying type code to get. Return Value: This method returns the code of the underlying type, or Empty if type is null. Bel 2 min read C# | Type.GetEnumUnderlyingType() Method Type.GetEnumUnderlyingType() Method is used to return the underlying type of the current enumeration type. Syntax: public virtual Type GetEnumUnderlyingType (); Return Value: This method returns the underlying type of the current enumeration. Exception: This method will return the ArgumentException 2 min read C# | Type.GetTypeArray() Method Type.GetTypeArray() Method is used to get the types of the objects in the specified array. Syntax: public static Type[] GetTypeArray (object[] args); Here, it takes an array of objects whose types to determine. Return Value: This method returns an array of Type objects representing the types of the 2 min read C# | Type.GetMember() Method Type.GetMember() Method is used to get the specified members of the current Type. There are 3 methods in the overload list of this method as follows: GetMember(String) Method GetMember(String, BindingFlags) Method GetMember(String, MemberTypes, BindingFlags) Method GetMember(String) Method This meth 6 min read C# | Type.GetMembers() Method Type.GetMembers() Method is used to get the members (properties, methods, fields, events, and so on) of the current Type. There are 2 methods in the overload list of this method as follows: GetMembers() Method GetMembers(BindingFlags) Method GetMembers() Method This method is used to return all the 4 min read C# | Type.GetMethods() Method Type.GetMethods() Method is used to get the methods of the current Type. There are 2 methods in the overload list of this method as follows: GetMethods(BindingFlags) Method GetMethods() Method GetMethods(BindingFlags) Method This method is used to search for the methods defined for the current Type, 5 min read C# | Type.GetTypeHandle() Method Type.GetTypeHandle() Method is used to get the handle for the Type of a specified object. Syntax: public static RuntimeTypeHandle GetTypeHandle (object o); Here, it takes the object for which to get the type handle. Return Value: This method returns The handle for the Type of the specified Object. E 2 min read Like