Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Type.IsArray Property

Gets a value that indicates whether the type is an array.

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

public bool IsArray { get; }

Property Value

Type: System.Boolean
true if the current type is an array; otherwise, false.



The IsArray property returns false for the Array class. It also returns false if the current instance is a Type object that represents a collection type or an interface designed to work with collections, such as IEnumerable or IEnumerable<T>.

To check for an array, use code such as:


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.

This property is read-only.

The following example demonstrates using the IsArray property.

using System;
using System.Collections;
using System.Collections.Generic;

public class Example
   public static void Main()
      Type[] types = { typeof(String), typeof(int[]),
                       typeof(ArrayList), typeof(Array),
                       typeof(IEnumerable<Char>) };
      foreach (var t in types)
         Console.WriteLine("{0,-15} IsArray = {1}", t.Name + ":",
// The example displays the following output: 
//       String:         IsArray = False 
//       Int32[]:        IsArray = True 
//       ArrayList:      IsArray = False 
//       Array:          IsArray = False 
//       List`1:         IsArray = False 
//       IEnumerable`1:  IsArray = False

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
© 2015 Microsoft