Type.HasElementType Property


Gets a value indicating whether the current Type encompasses or refers to another type; that is, whether the current Type is an array, a pointer, or is passed by reference.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

abstract HasElementType : bool with get
override HasElementType : bool with get

Property Value

Type: System.Boolean

true if the Type is an array, a pointer, or is passed by reference; otherwise, false.

For example, Type.GetType("Int32[]").HasElementType returns true, but Type.GetType("Int32").HasElementType returns false. HasElementType also returns true for "Int32*" and "Int32&".

If the current Type represents a generic type, or a type parameter in the definition of a generic type or generic method, this property always returns false.

The following example returns true or false depending on whether or not the object is an array, a reference type, or a pointer.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top