Type.Attributes 속성

Type과 관련된 특성을 가져옵니다.

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

구문

‘선언
Public ReadOnly Property Attributes As TypeAttributes
‘사용 방법
Dim instance As Type
Dim value As TypeAttributes

value = instance.Attributes
public TypeAttributes Attributes { get; }
public:
virtual property TypeAttributes Attributes {
    TypeAttributes get () sealed;
}
/** @property */
public final TypeAttributes get_Attributes ()
public final function get Attributes () : TypeAttributes

속성 값

Type이 값이 지정되어 있지 않은 제네릭 형식 매개 변수를 나타내지 않는 경우 Type의 특성 집합을 나타내는 TypeAttributes 개체입니다.

설명

현재 Type이 생성된 제네릭 형식을 나타내는 경우 이 속성은 제네릭 형식 정의의 특성을 반환합니다. 예를 들어, MyGenericClass<int>(Visual Basic의 경우 MyGenericClass(Of Integer))에 대해 반환된 특성은 MyGenericClass<T>(Visual Basic의 경우 MyGenericClass(Of T))의 특성입니다.

현재 Type이 제네릭 형식 매개 변수를 나타내는 경우, 즉 IsGenericParameter 속성이 true를 반환하는 경우 이 속성에서 반환하는 TypeAttributes 값은 지정되어 있지 않습니다.

예제

다음 예제에서는 Type.Attributes 속성을 사용하는 방법을 보여 줍니다.

Imports System
Imports System.Reflection

Public Class Class1
    Protected t As Type
    Public Sub Method1()
        If t.Attributes And TypeAttributes.ClassSemanticsMask = TypeAttributes.Interface Then
            Console.WriteLine("t is an interface.")
        End If
        If t.Attributes And TypeAttributes.Public <> 0 Then
            Console.WriteLine("t is public.")
        End If
    End Sub 'Method1
End Class 'Class1
using System;
using System.Reflection;

public class Class1 
{
    protected Type t;
    public void Method1() 
    {
        if ((t.Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface)
            Console.WriteLine ("t is an interface.");
        if ((t.Attributes & TypeAttributes.Public) != 0)
            Console.WriteLine ("t is public.");
    }
}
#using <System.DLL>

using namespace System;
using namespace System::Reflection;
ref class Sample
{
private:
   void Method( Type^ t )
   {
      if ( (t->Attributes & TypeAttributes::ClassSemanticsMask) == TypeAttributes::Interface )
            Console::WriteLine(  "t is an interface." );

      if ( (t->Attributes & TypeAttributes::Public) != (TypeAttributes)0 )
            Console::WriteLine(  "t is public." );
   }

};
import System.*;
import System.Reflection.*;

public class Class1
{
    protected Type t;    
    public void Method1()
    {
        if ((t.get_Attributes() & TypeAttributes.ClassSemanticsMask)
            == TypeAttributes.Interface  ) {
                Console.WriteLine("t is an interface.");
        }
        if (((int)(t.get_Attributes() & TypeAttributes.Public)) != 0  ) {
            Console.WriteLine("t is public.");
        }
    } //Method1
} //Class1
if ((t.Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface)
    Console.WriteLine ("t is an Interface");
if ((t.Attributes & TypeAttributes.Public) != 0)
    Console.WriteLine ("t is public");

플랫폼

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 네임스페이스
GetAttributeFlagsImpl
TypeAttributes