C# TypeInfo IsArray

Description

TypeInfo IsArray Gets a value indicating whether the Type is an array.

Syntax

TypeInfo.IsArray has the following syntax.


public bool IsArray { get; }

Example

The following example demonstrates using the IsArray property.


/*  ww  w  . jav  a 2  s  . c  o  m*/
using System;
class TestIsArray 
{
    public static void Main() 
    {
        int [] array = {1,2,3,4};
        Type at = typeof(Array);
        Type t = array.GetType();
        Console.WriteLine("The type is {0}. Is this type an array? {1}", at, at.IsArray);
        Console.WriteLine("The type is {0}. Is this type an array? {1}", t, t.IsArray);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo