CustomAttributeExtensions.GetCustomAttribute Metoda

Definice

Načte vlastní atribut, který se použije na zadaný prvek.

Přetížení

Name Description
GetCustomAttribute(Assembly, Type)

Načte vlastní atribut zadaného typu, který se použije na zadané sestavení.

GetCustomAttribute(MemberInfo, Type)

Načte vlastní atribut zadaného typu, který se použije na zadaný člen.

GetCustomAttribute(Module, Type)

Načte vlastní atribut zadaného typu, který se použije v zadaném modulu.

GetCustomAttribute(ParameterInfo, Type)

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr.

GetCustomAttribute(MemberInfo, Type, Boolean)

Načte vlastní atribut zadaného typu, který se použije u zadaného členu, a volitelně zkontroluje předky daného člena.

GetCustomAttribute(ParameterInfo, Type, Boolean)

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr, a volitelně zkontroluje předky tohoto parametru.

GetCustomAttribute<T>(ParameterInfo, Boolean)

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr, a volitelně zkontroluje předky tohoto parametru.

GetCustomAttribute<T>(MemberInfo, Boolean)

Načte vlastní atribut zadaného typu, který se použije u zadaného členu, a volitelně zkontroluje předky daného člena.

GetCustomAttribute<T>(ParameterInfo)

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr.

GetCustomAttribute<T>(Module)

Načte vlastní atribut zadaného typu, který se použije v zadaném modulu.

GetCustomAttribute<T>(MemberInfo)

Načte vlastní atribut zadaného typu, který se použije na zadaný člen.

GetCustomAttribute<T>(Assembly)

Načte vlastní atribut zadaného typu, který se použije na zadané sestavení.

GetCustomAttribute(Assembly, Type)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadané sestavení.

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

Sestavení, které chcete zkontrolovat.

attributeType
Type

Typ atributu, který chcete vyhledat.

Návraty

Vlastní atribut, který odpovídá attributeType, nebo null pokud se takový atribut nenajde.

Výjimky

element nebo attributeType je null.

attributeType není odvozeno z Attribute.

Bylo nalezeno více než jeden z požadovaných atributů.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute(MemberInfo, Type)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadaný člen.

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

Člen, který chcete zkontrolovat.

attributeType
Type

Typ atributu, který chcete vyhledat.

Návraty

Vlastní atribut, který odpovídá attributeType, nebo null pokud se takový atribut nenajde.

Výjimky

element nebo attributeType je null.

attributeType není odvozeno z Attribute.

element není konstruktor, metoda, vlastnost, událost, typ nebo pole.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute(Module, Type)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije v zadaném modulu.

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

Modul, který chcete zkontrolovat.

attributeType
Type

Typ atributu, který chcete vyhledat.

Návraty

Vlastní atribut, který odpovídá attributeType, nebo null pokud se takový atribut nenajde.

Výjimky

element nebo attributeType je null.

attributeType není odvozeno z Attribute.

Bylo nalezeno více než jeden z požadovaných atributů.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute(ParameterInfo, Type)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr.

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, který chcete zkontrolovat.

attributeType
Type

Typ atributu, který chcete vyhledat.

Návraty

Vlastní atribut, který odpovídá attributeType, nebo null pokud se takový atribut nenajde.

Výjimky

element nebo attributeType je null.

attributeType není odvozeno z Attribute.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute(MemberInfo, Type, Boolean)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije u zadaného členu, a volitelně zkontroluje předky daného člena.

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

Člen, který chcete zkontrolovat.

attributeType
Type

Typ atributu, který chcete vyhledat.

inherit
Boolean

true kontrolovat předky element; jinak , false.

Návraty

Vlastní atribut, který odpovídá attributeType, nebo null pokud se takový atribut nenajde.

Výjimky

element nebo attributeType je null.

attributeType není odvozeno z Attribute.

element není konstruktor, metoda, vlastnost, událost, typ nebo pole.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute(ParameterInfo, Type, Boolean)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr, a volitelně zkontroluje předky tohoto 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, který chcete zkontrolovat.

attributeType
Type

Typ atributu, který chcete vyhledat.

inherit
Boolean

true kontrolovat předky element; jinak , false.

Návraty

Vlastní atribut odpovídající attributeTypenebo null pokud se takový atribut nenajde.

Výjimky

element nebo attributeType je null.

attributeType není odvozeno z Attribute.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute<T>(ParameterInfo, Boolean)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr, a volitelně zkontroluje předky tohoto 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 atributu, který chcete vyhledat.

Parametry

element
ParameterInfo

Parametr, který chcete zkontrolovat.

inherit
Boolean

true kontrolovat předky element; jinak , false.

Návraty

T

Vlastní atribut, který odpovídá T, nebo null pokud se takový atribut nenajde.

Výjimky

element je null.

element není konstruktor, metoda, vlastnost, událost, typ nebo pole.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute<T>(MemberInfo, Boolean)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije u zadaného členu, a volitelně zkontroluje předky daného člena.

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 atributu, který chcete vyhledat.

Parametry

element
MemberInfo

Člen, který chcete zkontrolovat.

inherit
Boolean

true kontrolovat předky element; jinak , false.

Návraty

T

Vlastní atribut, který odpovídá T, nebo null pokud se takový atribut nenajde.

Výjimky

element je null.

element není konstruktor, metoda, vlastnost, událost, typ nebo pole.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute<T>(ParameterInfo)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadaný parametr.

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 atributu, který chcete vyhledat.

Parametry

element
ParameterInfo

Parametr, který chcete zkontrolovat.

Návraty

T

Vlastní atribut, který odpovídá T, nebo null pokud se takový atribut nenajde.

Výjimky

element je null.

element není konstruktor, metoda, vlastnost, událost, typ nebo pole.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute<T>(Module)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije v zadaném modulu.

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 atributu, který chcete vyhledat.

Parametry

element
Module

Modul, který chcete zkontrolovat.

Návraty

T

Vlastní atribut, který odpovídá T, nebo null pokud se takový atribut nenajde.

Výjimky

element je null.

Bylo nalezeno více než jeden z požadovaných atributů.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute<T>(MemberInfo)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadaný člen.

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 atributu, který chcete vyhledat.

Parametry

element
MemberInfo

Člen, který chcete zkontrolovat.

Návraty

T

Vlastní atribut, který odpovídá T, nebo null pokud se takový atribut nenajde.

Výjimky

element je null.

element není konstruktor, metoda, vlastnost, událost, typ nebo pole.

Bylo nalezeno více než jeden z požadovaných atributů.

Vlastní typ atributu nelze načíst.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro

GetCustomAttribute<T>(Assembly)

Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs
Zdroj:
CustomAttributeExtensions.cs

Načte vlastní atribut zadaného typu, který se použije na zadané sestavení.

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 atributu, který chcete vyhledat.

Parametry

element
Assembly

Sestavení, které chcete zkontrolovat.

Návraty

T

Vlastní atribut, který odpovídá T, nebo null pokud se takový atribut nenajde.

Výjimky

element je null.

Bylo nalezeno více než jeden z požadovaných atributů.

Poznámky

Metodu GetCustomAttributes rozšíření použijte, pokud očekáváte, že se vrátí více než jedna hodnota, nebo AmbiguousMatchException bude vyvolán.

Platí pro