CustomAttributeExtensions.GetCustomAttribute Metódus
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri a megadott elemre alkalmazott egyéni attribútumot.
Túlterhelések
| Name | Description |
|---|---|
| GetCustomAttribute(Assembly, Type) |
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott szerelvényre alkalmaz. |
| GetCustomAttribute(MemberInfo, Type) |
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott tagra alkalmaz. |
| GetCustomAttribute(Module, Type) |
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott modulra alkalmaz. |
| GetCustomAttribute(ParameterInfo, Type) |
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott paraméterre alkalmaz. |
| GetCustomAttribute(MemberInfo, Type, Boolean) |
Lekéri a megadott típusú egyéni attribútumot, amely egy adott tagra lesz alkalmazva, és opcionálisan az adott tag elődeit vizsgálja meg. |
| GetCustomAttribute(ParameterInfo, Type, Boolean) |
Lekéri a megadott típusú egyéni attribútumot, amely egy adott paraméterre van alkalmazva, és opcionálisan az adott paraméter elődeit vizsgálja. |
| GetCustomAttribute<T>(ParameterInfo, Boolean) |
Lekéri a megadott típusú egyéni attribútumot, amely egy adott paraméterre van alkalmazva, és opcionálisan az adott paraméter elődeit vizsgálja. |
| GetCustomAttribute<T>(MemberInfo, Boolean) |
Lekéri a megadott típusú egyéni attribútumot, amely egy adott tagra lesz alkalmazva, és opcionálisan az adott tag elődeit vizsgálja meg. |
| GetCustomAttribute<T>(ParameterInfo) |
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott paraméterre alkalmaz. |
| GetCustomAttribute<T>(Module) |
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott modulra alkalmaz. |
| GetCustomAttribute<T>(MemberInfo) |
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott tagra alkalmaz. |
| GetCustomAttribute<T>(Assembly) |
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott szerelvényre alkalmaz. |
GetCustomAttribute(Assembly, Type)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott szerelvényre alkalmaz.
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
Paraméterek
- element
- Assembly
A vizsgálandó szerelvény.
- attributeType
- Type
A keresendő attribútum típusa.
Válaszok
Egy egyéni attribútum, amely megfelel attributeType, vagy null ha nem található ilyen attribútum.
Kivételek
element vagy attributeType az null.
attributeType nem származik a .-ból Attribute.
A rendszer több kért attribútumot is talált.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute(MemberInfo, Type)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott tagra alkalmaz.
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
Paraméterek
- element
- MemberInfo
A vizsgálandó tag.
- attributeType
- Type
A keresendő attribútum típusa.
Válaszok
Egy egyéni attribútum, amely megfelel attributeType, vagy null ha nem található ilyen attribútum.
Kivételek
element vagy attributeType az null.
attributeType nem származik a .-ból Attribute.
element nem konstruktor, metódus, tulajdonság, esemény, típus vagy mező.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute(Module, Type)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott modulra alkalmaz.
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
Paraméterek
- element
- Module
A vizsgálandó modul.
- attributeType
- Type
A keresendő attribútum típusa.
Válaszok
Egy egyéni attribútum, amely megfelel attributeType, vagy null ha nem található ilyen attribútum.
Kivételek
element vagy attributeType az null.
attributeType nem származik a .-ból Attribute.
A rendszer több kért attribútumot is talált.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute(ParameterInfo, Type)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott paraméterre alkalmaz.
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
Paraméterek
- element
- ParameterInfo
A vizsgálandó paraméter.
- attributeType
- Type
A keresendő attribútum típusa.
Válaszok
Egy egyéni attribútum, amely megfelel attributeType, vagy null ha nem található ilyen attribútum.
Kivételek
element vagy attributeType az null.
attributeType nem származik a .-ból Attribute.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute(MemberInfo, Type, Boolean)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amely egy adott tagra lesz alkalmazva, és opcionálisan az adott tag elődeit vizsgálja meg.
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
Paraméterek
- element
- MemberInfo
A vizsgálandó tag.
- attributeType
- Type
A keresendő attribútum típusa.
- inherit
- Boolean
truehogy vizsgálja meg az ősökelement; egyébként. false
Válaszok
Egy egyéni attribútum, amely megfelel attributeType, vagy null ha nem található ilyen attribútum.
Kivételek
element vagy attributeType az null.
attributeType nem származik a .-ból Attribute.
element nem konstruktor, metódus, tulajdonság, esemény, típus vagy mező.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute(ParameterInfo, Type, Boolean)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amely egy adott paraméterre van alkalmazva, és opcionálisan az adott paraméter elődeit vizsgálja.
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
Paraméterek
- element
- ParameterInfo
A vizsgálandó paraméter.
- attributeType
- Type
A keresendő attribútum típusa.
- inherit
- Boolean
truehogy vizsgálja meg az ősökelement; egyébként. false
Válaszok
Egyéni attribútumegyeztetés attributeType, vagy null ha nem található ilyen attribútum.
Kivételek
element vagy attributeType az null.
attributeType nem származik a .-ból Attribute.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute<T>(ParameterInfo, Boolean)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amely egy adott paraméterre van alkalmazva, és opcionálisan az adott paraméter elődeit vizsgálja.
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ípusparaméterek
- T
A keresendő attribútum típusa.
Paraméterek
- element
- ParameterInfo
A vizsgálandó paraméter.
- inherit
- Boolean
truehogy vizsgálja meg az ősökelement; egyébként. false
Válaszok
Egy egyéni attribútum, amely megfelel T, vagy null ha nem található ilyen attribútum.
Kivételek
element az null.
element nem konstruktor, metódus, tulajdonság, esemény, típus vagy mező.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute<T>(MemberInfo, Boolean)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amely egy adott tagra lesz alkalmazva, és opcionálisan az adott tag elődeit vizsgálja meg.
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ípusparaméterek
- T
A keresendő attribútum típusa.
Paraméterek
- element
- MemberInfo
A vizsgálandó tag.
- inherit
- Boolean
truehogy vizsgálja meg az ősökelement; egyébként. false
Válaszok
Egy egyéni attribútum, amely megfelel T, vagy null ha nem található ilyen attribútum.
Kivételek
element az null.
element nem konstruktor, metódus, tulajdonság, esemény, típus vagy mező.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute<T>(ParameterInfo)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott paraméterre alkalmaz.
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ípusparaméterek
- T
A keresendő attribútum típusa.
Paraméterek
- element
- ParameterInfo
A vizsgálandó paraméter.
Válaszok
Egy egyéni attribútum, amely megfelel T, vagy null ha nem található ilyen attribútum.
Kivételek
element az null.
element nem konstruktor, metódus, tulajdonság, esemény, típus vagy mező.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute<T>(Module)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott modulra alkalmaz.
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ípusparaméterek
- T
A keresendő attribútum típusa.
Paraméterek
- element
- Module
A vizsgálandó modul.
Válaszok
Egy egyéni attribútum, amely megfelel T, vagy null ha nem található ilyen attribútum.
Kivételek
element az null.
A rendszer több kért attribútumot is talált.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute<T>(MemberInfo)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott tagra alkalmaz.
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ípusparaméterek
- T
A keresendő attribútum típusa.
Paraméterek
- element
- MemberInfo
A vizsgálandó tag.
Válaszok
Egy egyéni attribútum, amely megfelel T, vagy null ha nem található ilyen attribútum.
Kivételek
element az null.
element nem konstruktor, metódus, tulajdonság, esemény, típus vagy mező.
A rendszer több kért attribútumot is talált.
Egyéni attribútumtípus nem tölthető be.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.
A következőre érvényes:
GetCustomAttribute<T>(Assembly)
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
- Forrás:
- CustomAttributeExtensions.cs
Lekéri a megadott típusú egyéni attribútumot, amelyet egy adott szerelvényre alkalmaz.
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ípusparaméterek
- T
A keresendő attribútum típusa.
Paraméterek
- element
- Assembly
A vizsgálandó szerelvény.
Válaszok
Egy egyéni attribútum, amely megfelel T, vagy null ha nem található ilyen attribútum.
Kivételek
element az null.
A rendszer több kért attribútumot is talált.
Megjegyzések
Akkor használja a GetCustomAttributes bővítménymetódust, ha egynél több értéket szeretne visszaadni, vagy AmbiguousMatchException dobni fog.