C# TypeInfo HasElementType
Description
TypeInfo HasElementType
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.
Syntax
TypeInfo.HasElementType
has the following syntax.
public bool HasElementType { get; }
Example
using System;//from ww w . ja v a 2 s.c o m
using System.Reflection;
public class Example
{
unsafe public void Test(ref int x, out int y, int* z)
{
*z = x = y = 0;
}
public static void Main()
{
int[] nums = {1, 1, 2, 3, 5, 8, 13};
Type t = nums.GetType();
Console.WriteLine("HasElementType is '{0}' for array types.", t.HasElementType);
t = typeof(Example[]);
Console.WriteLine("HasElementType is '{0}' for array types.", t.HasElementType);
}
}
The code above generates the following result.