Mono Class Library: System.Type Overview | Members

System.Type.IsArray Property

Gets a bool value that indicates whether the current Type represents an array.

public bool IsArray { get; }

Value

true if the current Type represents an array; otherwise false.

Remarks

This property is read-only.

This property returns true for an array of objects, but not for the Array type itself, which is a class.

If the current instance represents a generic type, or a type parameter of a generic type or method, this property returns false.

Example

The following example demonstrates using the Type.IsArray property.

C# Example

using System;
class TestType {
 public static void Main() {
 int [] array = {1,2,3,4};
 Type at = typeof(Array);
 Type t = array.GetType();
 Console.WriteLine("Type is {0}. IsArray? {1}", at, at.IsArray);
 Console.WriteLine("Type is {0}. IsArray? {1}", t, t.IsArray);
 }
}

The output is

Type is System.Array. IsArray? False
Type is System.Int32[]. IsArray? True

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0