CustomAttributeExtensions.GetCustomAttribute 메서드

정의

지정된 요소에 적용된 사용자 지정 특성을 검색합니다.

오버로드

GetCustomAttribute(Assembly, Type)

지정된 어셈블리에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute(MemberInfo, Type)

지정된 멤버에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute(Module, Type)

지정된 모듈에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute(ParameterInfo, Type)

지정된 매개 변수에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute(MemberInfo, Type, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 멤버에 적용되는 컬렉션을 검색하거나 선택적으로 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttribute(ParameterInfo, Type, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 매개 변수에 적용되는 컬렉션을 검색하거나 선택적으로 해당 매개 변수의 상위 항목을 검사합니다.

GetCustomAttribute<T>(ParameterInfo, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 매개 변수에 적용되는 컬렉션을 검색하거나 선택적으로 해당 매개 변수의 상위 항목을 검사합니다.

GetCustomAttribute<T>(MemberInfo, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 멤버에 적용되는 컬렉션을 검색하거나 선택적으로 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttribute<T>(ParameterInfo)

지정된 매개 변수에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute<T>(Module)

지정된 모듈에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute<T>(MemberInfo)

지정된 멤버에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute<T>(Assembly)

지정된 어셈블리에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute(Assembly, Type)

지정된 어셈블리에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::Assembly ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.Assembly element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.Assembly element, Type attributeType);
static member GetCustomAttribute : System.Reflection.Assembly * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As Assembly, attributeType As Type) As Attribute

매개 변수

element
Assembly

조사할 어셈블리입니다.

attributeType
Type

검색할 특성의 형식입니다.

반환

Attribute

이런 특성이 없을 경우 attributeType 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element 또는 attributeTypenull인 경우

attributeTypeAttribute에서 파생되지 않은 경우

요청된 특성이 둘 이상 발견된 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute(MemberInfo, Type)

지정된 멤버에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::MemberInfo ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType);
static member GetCustomAttribute : System.Reflection.MemberInfo * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As MemberInfo, attributeType As Type) As Attribute

매개 변수

element
MemberInfo

검사할 멤버입니다.

attributeType
Type

검색할 특성의 형식입니다.

반환

Attribute

이런 특성이 없을 경우 attributeType 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element 또는 attributeTypenull인 경우

attributeTypeAttribute에서 파생되지 않은 경우

element가 생성자, 메서드, 속성, 이벤트, 형식 또는 필드가 아닌 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute(Module, Type)

지정된 모듈에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::Module ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.Module element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.Module element, Type attributeType);
static member GetCustomAttribute : System.Reflection.Module * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As Module, attributeType As Type) As Attribute

매개 변수

element
Module

검사할 모듈입니다.

attributeType
Type

검색할 특성의 형식입니다.

반환

Attribute

이런 특성이 없을 경우 attributeType 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element 또는 attributeTypenull인 경우

attributeTypeAttribute에서 파생되지 않은 경우

요청된 특성이 둘 이상 발견된 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute(ParameterInfo, Type)

지정된 매개 변수에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::ParameterInfo ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType);
static member GetCustomAttribute : System.Reflection.ParameterInfo * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As ParameterInfo, attributeType As Type) As Attribute

매개 변수

element
ParameterInfo

검사할 매개 변수입니다.

attributeType
Type

검색할 특성의 형식입니다.

반환

Attribute

이런 특성이 없을 경우 attributeType 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element 또는 attributeTypenull인 경우

attributeTypeAttribute에서 파생되지 않은 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute(MemberInfo, Type, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 멤버에 적용되는 컬렉션을 검색하거나 선택적으로 해당 멤버의 상위 항목을 검사합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::MemberInfo ^ element, Type ^ attributeType, bool inherit);
public static Attribute GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
public static Attribute? GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
static member GetCustomAttribute : System.Reflection.MemberInfo * Type * bool -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As MemberInfo, attributeType As Type, inherit As Boolean) As Attribute

매개 변수

element
MemberInfo

검사할 멤버입니다.

attributeType
Type

검색할 특성의 형식입니다.

inherit
Boolean

element의 상위 요소를 검사하려면 true이고, 그렇지 않으면 false입니다.

반환

Attribute

이런 특성이 없을 경우 attributeType 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element 또는 attributeTypenull인 경우

attributeTypeAttribute에서 파생되지 않은 경우

element가 생성자, 메서드, 속성, 이벤트, 형식 또는 필드가 아닌 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute(ParameterInfo, Type, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 매개 변수에 적용되는 컬렉션을 검색하거나 선택적으로 해당 매개 변수의 상위 항목을 검사합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::ParameterInfo ^ element, Type ^ attributeType, bool inherit);
public static Attribute GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
public static Attribute? GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
static member GetCustomAttribute : System.Reflection.ParameterInfo * Type * bool -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As ParameterInfo, attributeType As Type, inherit As Boolean) As Attribute

매개 변수

element
ParameterInfo

검사할 매개 변수입니다.

attributeType
Type

검색할 특성의 형식입니다.

inherit
Boolean

element의 상위 요소를 검사하려면 true이고, 그렇지 않으면 false입니다.

반환

Attribute

attributeType과 일치하는 사용자 지정 특성이거나, 이러한 특성이 없으면 null입니다.

예외

element 또는 attributeTypenull인 경우

attributeTypeAttribute에서 파생되지 않은 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute<T>(ParameterInfo, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 매개 변수에 적용되는 컬렉션을 검색하거나 선택적으로 해당 매개 변수의 상위 항목을 검사합니다.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::ParameterInfo ^ element, bool inherit);
public static T GetCustomAttribute<T> (this System.Reflection.ParameterInfo element, bool inherit) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.ParameterInfo element, bool inherit) where T : Attribute;
static member GetCustomAttribute : System.Reflection.ParameterInfo * bool -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As ParameterInfo, inherit As Boolean) As T

형식 매개 변수

T

검색할 특성의 형식입니다.

매개 변수

element
ParameterInfo

검사할 매개 변수입니다.

inherit
Boolean

element의 상위 요소를 검사하려면 true이고, 그렇지 않으면 false입니다.

반환

T

이런 특성이 없을 경우 T 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element이(가) null인 경우

element가 생성자, 메서드, 속성, 이벤트, 형식 또는 필드가 아닌 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute<T>(MemberInfo, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 멤버에 적용되는 컬렉션을 검색하거나 선택적으로 해당 멤버의 상위 항목을 검사합니다.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::MemberInfo ^ element, bool inherit);
public static T GetCustomAttribute<T> (this System.Reflection.MemberInfo element, bool inherit) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.MemberInfo element, bool inherit) where T : Attribute;
static member GetCustomAttribute : System.Reflection.MemberInfo * bool -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As MemberInfo, inherit As Boolean) As T

형식 매개 변수

T

검색할 특성의 형식입니다.

매개 변수

element
MemberInfo

검사할 멤버입니다.

inherit
Boolean

element의 상위 요소를 검사하려면 true이고, 그렇지 않으면 false입니다.

반환

T

이런 특성이 없을 경우 T 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element이(가) null인 경우

element가 생성자, 메서드, 속성, 이벤트, 형식 또는 필드가 아닌 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute<T>(ParameterInfo)

지정된 매개 변수에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::ParameterInfo ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.ParameterInfo element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.ParameterInfo element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.ParameterInfo -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As ParameterInfo) As T

형식 매개 변수

T

검색할 특성의 형식입니다.

매개 변수

element
ParameterInfo

검사할 매개 변수입니다.

반환

T

이런 특성이 없을 경우 T 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element이(가) null인 경우

element가 생성자, 메서드, 속성, 이벤트, 형식 또는 필드가 아닌 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute<T>(Module)

지정된 모듈에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::Module ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.Module element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.Module element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.Module -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As Module) As T

형식 매개 변수

T

검색할 특성의 형식입니다.

매개 변수

element
Module

검사할 모듈입니다.

반환

T

이런 특성이 없을 경우 T 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element이(가) null인 경우

요청된 특성이 둘 이상 발견된 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute<T>(MemberInfo)

지정된 멤버에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::MemberInfo ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.MemberInfo element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.MemberInfo element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.MemberInfo -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As MemberInfo) As T

형식 매개 변수

T

검색할 특성의 형식입니다.

매개 변수

element
MemberInfo

검사할 멤버입니다.

반환

T

이런 특성이 없을 경우 T 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element이(가) null인 경우

element가 생성자, 메서드, 속성, 이벤트, 형식 또는 필드가 아닌 경우

요청된 특성이 둘 이상 발견된 경우

사용자 지정 특성 형식을 로드할 수 없는 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상

GetCustomAttribute<T>(Assembly)

지정된 어셈블리에 적용된 지정된 형식의 사용자 지정 특성을 검색합니다.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::Assembly ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.Assembly element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.Assembly element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.Assembly -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As Assembly) As T

형식 매개 변수

T

검색할 특성의 형식입니다.

매개 변수

element
Assembly

조사할 어셈블리입니다.

반환

T

이런 특성이 없을 경우 T 또는 null과 일치하는 사용자 지정 특성입니다.

예외

element이(가) null인 경우

요청된 특성이 둘 이상 발견된 경우

설명

둘 이상의 값이 GetCustomAttributes 반환 AmbiguousMatchException 되거나 throw될 것으로 예상되는 경우 확장 메서드를 사용합니다.

적용 대상