다음을 통해 공유


Type.IsArray 속성

Type이 배열인지 여부를 나타내는 값을 가져옵니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public ReadOnly Property IsArray As Boolean
‘사용 방법
Dim instance As Type
Dim value As Boolean

value = instance.IsArray
public bool IsArray { get; }
public:
virtual property bool IsArray {
    bool get () sealed;
}
/** @property */
public final boolean get_IsArray ()
public final function get IsArray () : boolean

속성 값

Type이 배열이면 true이고, 그렇지 않으면 false입니다.

설명

IsArray 속성은 Array 클래스에 대해 false를 반환합니다.

배열을 확인하려면 typeof(Array).IsAssignableFrom(type) 같은 코드를 사용합니다.

현재 Type이 제네릭 형식을 나타내거나 제네릭 형식 또는 제네릭 메서드 정의의 형식 매개 변수를 나타내는 경우 이 속성은 항상 false를 반환합니다.

이 속성은 읽기 전용입니다.

예제

다음 예제에서는 IsArray 속성 사용에 대해 설명합니다.

Imports System

Class TestIsArray
    Public Shared Sub Main()
        Dim array As Integer() =  {1, 2, 3, 4}
        Dim at As Type = GetType(Array)
        Dim t As Type = 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)
    End Sub 'Main
End Class 'TestType
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);
    }
}
using namespace System;
int main()
{
   array<Int32>^array = {1,2,3,4};
   Type^ at = Array::typeid;
   Type^ t = array->GetType();
   Console::WriteLine( "The type is {0}. Is this type an array? {1}", at, at->IsArray.ToString() );
   Console::WriteLine( "The type is {0}. Is this type an array? {1}", t, t->IsArray.ToString() );
}
import System.*;

class TestIsArray
{
    public static void main(String[] args)
    {
        int array[] =  { 1, 2, 3, 4 };
        Type at = Array.class.ToType();
        Type t = array.GetType();
        Console.WriteLine("The type is {0}. Is this type an array? {1}",
            System.Convert.ToString(at),
            System.Convert.ToString(at.get_IsArray()));
        Console.WriteLine("The type is {0}. Is this type an array? {1}", 
            System.Convert.ToString(t),
            System.Convert.ToString(t.get_IsArray()));
    } //main
} //TestIsArray

이 코드는 다음과 같이 출력됩니다.

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

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Type 클래스
Type 멤버
System 네임스페이스
IsArrayImpl