Assembly.GetCustomAttributes 메서드

정의

이 어셈블리에 대한 사용자 지정 특성을 가져옵니다.

오버로드

GetCustomAttributes(Boolean)

이 어셈블리에 대한 사용자 지정 특성을 모두 가져옵니다.

GetCustomAttributes(Type, Boolean)

형식에 의해 지정된 대로, 이 어셈블리에 대한 사용자 지정 특성을 가져옵니다.

GetCustomAttributes(Boolean)

이 어셈블리에 대한 사용자 지정 특성을 모두 가져옵니다.

public:
 virtual cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public virtual object[] GetCustomAttributes (bool inherit);
abstract member GetCustomAttributes : bool -> obj[]
override this.GetCustomAttributes : bool -> obj[]
Public Overridable Function GetCustomAttributes (inherit As Boolean) As Object()

매개 변수

inherit
Boolean

이 인수는 Assembly 형식의 개체에 대해 무시됩니다.

반환

Object[]

이 어셈블리에 대한 사용자 지정 특성이 포함된 배열입니다.

구현

설명

이 메서드는 해당 ICustomAttributeProvider 인터페이스 메서드를 구현합니다. 따라서 매개 변수는 inherit 무시되더라도 지정해야 합니다.

의사 특성은 특성이 있을 때 설정해야 하는 핵심 메타데이터의 비트를 나타냅니다. 형식에 대한 메타데이터를 확장하고 형식과 함께 저장되는 사용자 지정 특성과 달리 의사 특성은 형식에 대한 메타데이터를 수정한 다음 삭제됩니다. 일부 결과 비트는 기존 리플렉션 API를 사용하여 액세스할 수 없습니다.

다음 표에는 리플렉션에서 사용할 수 있는 비트에 대한 다양한 의사 특성 및 접근자가 요약되어 있습니다.

Pseudo-Attribute 메타데이터 비트 리플렉션 접근자
DllImportAttribute CorPInvokeMap

DLL 이름
일반 메서드/전역 메서드 특성에 대한 PInvokeMap 접근자가 없습니다.

DLL 이름에 대한 접근자가 없습니다.
GuidAttribute 실제 사용자 지정 특성으로 저장됩니다. 실제 사용자 지정 특성으로 액세스됩니다.
ComImportAttribute CorTypeAttr.tdImport Type.Attributes.Import
SerializableAttribute CorTypeAttr.tdSerializable Type.Attributes.Serializable
NonSerializedAttribute CorFieldAttr.fdNotSerialized FieldInfo.Attributes.NotSerialized
MethodImplAttribute CorMethodImpl MethodInfo.GetMethodImplementationFlags()

ConstructorInfo.GetMethodImplementationFlags()
MarshalAsAttribute 다양한 비트. 접근자가 없습니다.
PreserveSigAttribute CorMethodImpl.miOLE MethodInfo.GetMethodImplementationFlags().OLE

ConstructorInfo.GetMethodImplementationFlags().OLE
InAttribute CorParamAttr.pdIn ParameterInfo.Attributes.In
OutAttribute CorParamAttr.pdOut ParameterInfo.Attributes.Out
StructLayoutAttribute CorTypeAttr.tdLayoutSequential

CorTypeAttr.tdExplicitLayout

CorTypeAttr.tdAnsiClass

CorTypeAttr.tdUnicodeClass

CorTypeAttr.tdAutoClass

클래스 압축.
Type.Attributes.LayoutSequential

Type.Attributes.ExplicitLayout

Type.Attributes.AnsiClass

Type.Attributes.UnicodeClass

Type.Attributes.AutoClass

접근자가 없습니다.
FieldOffsetAttribute 필드 오프셋입니다. 접근자가 없습니다.
AssemblyLoadAttribute CorAssemblyFlags 접근자 또는 열거자가 없습니다.

적용 대상

GetCustomAttributes(Type, Boolean)

형식에 의해 지정된 대로, 이 어셈블리에 대한 사용자 지정 특성을 가져옵니다.

public:
 virtual cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public virtual object[] GetCustomAttributes (Type attributeType, bool inherit);
abstract member GetCustomAttributes : Type * bool -> obj[]
override this.GetCustomAttributes : Type * bool -> obj[]
Public Overridable Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()

매개 변수

attributeType
Type

사용자 지정 특성이 반환될 형식입니다.

inherit
Boolean

이 인수는 Assembly 형식의 개체에 대해 무시됩니다.

반환

Object[]

attributeType에 의해 지정된 대로 이 어셈블리에 대한 사용자 지정 특성이 포함된 배열입니다.

구현

예외

attributeType이(가) null인 경우

attributeType이 런타임 형식이 아닙니다.

설명

이 메서드는 해당 ICustomAttributeProvider 인터페이스 메서드를 구현합니다. 따라서 매개 변수는 inherit 무시되더라도 지정해야 합니다.

의사 특성은 특성이 있을 때 설정해야 하는 핵심 메타데이터의 비트를 나타냅니다. 형식에 대한 메타데이터를 확장하고 형식과 함께 저장되는 사용자 지정 특성과 달리 의사 특성은 형식에 대한 메타데이터를 수정한 다음 삭제됩니다. 일부 결과 비트는 기존 리플렉션 API를 사용하여 액세스할 수 없습니다.

다음 표에는 리플렉션에서 사용할 수 있는 비트에 대한 다양한 의사 특성 및 접근자가 요약되어 있습니다.

Pseudo-Attribute 메타데이터 비트 리플렉션 접근자
DllImportAttribute CorPInvokeMap

DLL 이름
일반 메서드/전역 메서드 특성에 대한 PInvokeMap 접근자가 없습니다.

DLL 이름에 대한 접근자가 없습니다.
GuidAttribute 실제 사용자 지정 특성으로 저장됩니다. 실제 사용자 지정 특성으로 액세스됩니다.
ComImportAttribute CorTypeAttr.tdImport Type.Attributes.Import
SerializableAttribute CorTypeAttr.tdSerializable Type.Attributes.Serializable
NonSerializedAttribute CorFieldAttr.fdNotSerialized FieldInfo.Attributes.NotSerialized
MethodImplAttribute CorMethodImpl MethodInfo.GetMethodImplementationFlags()

ConstructorInfo.GetMethodImplementationFlags()
MarshalAsAttribute 다양한 비트. 접근자가 없습니다.
PreserveSigAttribute CorMethodImpl.miOLE MethodInfo.GetMethodImplementationFlags().OLE

ConstructorInfo.GetMethodImplementationFlags().OLE
InAttribute CorParamAttr.pdIn ParameterInfo.Attributes.In
OutAttribute CorParamAttr.pdOut ParameterInfo.Attributes.Out
StructLayoutAttribute CorTypeAttr.tdLayoutSequential

CorTypeAttr.tdExplicitLayout

CorTypeAttr.tdAnsiClass

CorTypeAttr.tdUnicodeClass

CorTypeAttr.tdAutoClass

클래스 압축.
Type.Attributes.LayoutSequential

Type.Attributes.ExplicitLayout

Type.Attributes.AnsiClass

Type.Attributes.UnicodeClass

Type.Attributes.AutoClass

접근자가 없습니다.
FieldOffsetAttribute 필드 오프셋입니다. 접근자가 없습니다.
AssemblyLoadAttribute CorAssemblyFlags 접근자 또는 열거자가 없습니다.

적용 대상