CustomAttributeExtensions.GetCustomAttribute Metoda

Definicja

Pobiera atrybut niestandardowy, który jest stosowany do określonego elementu.

Przeciążenia

GetCustomAttribute(Assembly, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego zestawu.

GetCustomAttribute(MemberInfo, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego.

GetCustomAttribute(Module, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego modułu.

GetCustomAttribute(ParameterInfo, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru.

GetCustomAttribute(MemberInfo, Type, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego, i opcjonalnie sprawdza elementów podrzędnych tego elementu członkowskiego.

GetCustomAttribute(ParameterInfo, Type, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru, i opcjonalnie sprawdza elementy podrzędne tego parametru.

GetCustomAttribute<T>(ParameterInfo, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru, i opcjonalnie sprawdza elementy podrzędne tego parametru.

GetCustomAttribute<T>(MemberInfo, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego, i opcjonalnie sprawdza elementów podrzędnych tego elementu członkowskiego.

GetCustomAttribute<T>(ParameterInfo)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru.

GetCustomAttribute<T>(Module)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego modułu.

GetCustomAttribute<T>(MemberInfo)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego.

GetCustomAttribute<T>(Assembly)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego zestawu.

GetCustomAttribute(Assembly, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego zestawu.

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

Parametry

element
Assembly

Zestaw do wglądu.

attributeType
Type

Typ atrybutu do wyszukiwania.

Zwraca

Attribute

Atrybut niestandardowy, który pasuje attributeTypedo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element lub attributeType to null.

attributeType nie pochodzi z Attributeelementu .

Znaleziono więcej niż jeden z wymaganych atrybutów.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute(MemberInfo, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego.

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

Parametry

element
MemberInfo

Element członkowski do wglądu.

attributeType
Type

Typ atrybutu do wyszukiwania.

Zwraca

Attribute

Atrybut niestandardowy, który pasuje attributeTypedo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element lub attributeType to null.

attributeType nie pochodzi z Attributeelementu .

element nie jest konstruktorem, metodą, właściwością, zdarzeniem, typem ani polem.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute(Module, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego modułu.

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

Parametry

element
Module

Moduł do wglądu.

attributeType
Type

Typ atrybutu do wyszukiwania.

Zwraca

Attribute

Atrybut niestandardowy, który pasuje attributeTypedo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element lub attributeType to null.

attributeType nie pochodzi z Attributeelementu .

Znaleziono więcej niż jeden z wymaganych atrybutów.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute(ParameterInfo, Type)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru.

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

Parametry

element
ParameterInfo

Parametr do wglądu.

attributeType
Type

Typ atrybutu do wyszukiwania.

Zwraca

Attribute

Atrybut niestandardowy, który pasuje attributeTypedo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element lub attributeType to null.

attributeType nie pochodzi z Attributeelementu .

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute(MemberInfo, Type, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego, i opcjonalnie sprawdza elementów podrzędnych tego elementu członkowskiego.

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

Parametry

element
MemberInfo

Element członkowski do wglądu.

attributeType
Type

Typ atrybutu do wyszukiwania.

inherit
Boolean

true do sprawdzenia przodków element; w przeciwnym razie , false.

Zwraca

Attribute

Atrybut niestandardowy, który pasuje attributeTypedo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element lub attributeType to null.

attributeType nie pochodzi z Attributeelementu .

element nie jest konstruktorem, metodą, właściwością, zdarzeniem, typem ani polem.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute(ParameterInfo, Type, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru, i opcjonalnie sprawdza elementy podrzędne tego parametru.

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

Parametry

element
ParameterInfo

Parametr do wglądu.

attributeType
Type

Typ atrybutu do wyszukiwania.

inherit
Boolean

true do sprawdzenia przodków element; w przeciwnym razie , false.

Zwraca

Attribute

Atrybut niestandardowy pasujący attributeTypedo atrybutu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element lub attributeType to null.

attributeType nie pochodzi z Attributeelementu .

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute<T>(ParameterInfo, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru, i opcjonalnie sprawdza elementy podrzędne tego parametru.

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

Parametry typu

T

Typ atrybutu do wyszukiwania.

Parametry

element
ParameterInfo

Parametr do wglądu.

inherit
Boolean

true do sprawdzenia przodków element; w przeciwnym razie , false.

Zwraca

T

Atrybut niestandardowy, który pasuje Tdo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element to null.

element nie jest konstruktorem, metodą, właściwością, zdarzeniem, typem ani polem.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute<T>(MemberInfo, Boolean)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego, i opcjonalnie sprawdza elementów podrzędnych tego elementu członkowskiego.

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

Parametry typu

T

Typ atrybutu do wyszukiwania.

Parametry

element
MemberInfo

Element członkowski do wglądu.

inherit
Boolean

true do sprawdzenia przodków element; w przeciwnym razie , false.

Zwraca

T

Atrybut niestandardowy, który pasuje Tdo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element to null.

element nie jest konstruktorem, metodą, właściwością, zdarzeniem, typem ani polem.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute<T>(ParameterInfo)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego parametru.

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

Parametry typu

T

Typ atrybutu do wyszukiwania.

Parametry

element
ParameterInfo

Parametr do wglądu.

Zwraca

T

Atrybut niestandardowy, który pasuje Tdo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element to null.

element nie jest konstruktorem, metodą, właściwością, zdarzeniem, typem ani polem.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute<T>(Module)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego modułu.

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

Parametry typu

T

Typ atrybutu do wyszukiwania.

Parametry

element
Module

Moduł do wglądu.

Zwraca

T

Atrybut niestandardowy, który pasuje Tdo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element to null.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute<T>(MemberInfo)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego elementu członkowskiego.

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

Parametry typu

T

Typ atrybutu do wyszukiwania.

Parametry

element
MemberInfo

Element członkowski do wglądu.

Zwraca

T

Atrybut niestandardowy, który pasuje Tdo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element to null.

element nie jest konstruktorem, metodą, właściwością, zdarzeniem, typem ani polem.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Nie można załadować typu niestandardowego atrybutu.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy

GetCustomAttribute<T>(Assembly)

Pobiera atrybut niestandardowy określonego typu, który jest stosowany do określonego zestawu.

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

Parametry typu

T

Typ atrybutu do wyszukiwania.

Parametry

element
Assembly

Zestaw do wglądu.

Zwraca

T

Atrybut niestandardowy, który pasuje Tdo elementu lub null jeśli taki atrybut nie zostanie znaleziony.

Wyjątki

element to null.

Znaleziono więcej niż jeden z wymaganych atrybutów.

Uwagi

GetCustomAttributes Użyj metody rozszerzenia, jeśli oczekujesz, że zostanie zwrócona więcej niż jedna wartość lub AmbiguousMatchException zostanie zwrócona.

Dotyczy