CustomAttributeExtensions.GetCustomAttribute Metodo
Definizione
Recupera un attributo personalizzato applicato a un elemento specificato.Retrieves a custom attribute that is applied to a specified element.
Overload
GetCustomAttribute(Assembly, Type) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un assembly specificato.Retrieves a custom attribute of a specified type that is applied to a specified assembly. |
GetCustomAttribute(MemberInfo, Type) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un membro specificato.Retrieves a custom attribute of a specified type that is applied to a specified member. |
GetCustomAttribute(Module, Type) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un modulo specificato.Retrieves a custom attribute of a specified type that is applied to a specified module. |
GetCustomAttribute(ParameterInfo, Type) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato.Retrieves a custom attribute of a specified type that is applied to a specified parameter. |
GetCustomAttribute(MemberInfo, Type, Boolean) |
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un membro specificato e verifica facoltativamente i predecessori di tale membro.Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member. |
GetCustomAttribute(ParameterInfo, Type, Boolean) |
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato e verifica facoltativamente i predecessori di tale parametro.Retrieves a custom attribute of a specified type that is applied to a specified parameter, and optionally inspects the ancestors of that parameter. |
GetCustomAttribute<T>(ParameterInfo, Boolean) |
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato e verifica facoltativamente i predecessori di tale parametro.Retrieves a custom attribute of a specified type that is applied to a specified parameter, and optionally inspects the ancestors of that parameter. |
GetCustomAttribute<T>(MemberInfo, Boolean) |
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un membro specificato e verifica facoltativamente i predecessori di tale membro.Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member. |
GetCustomAttribute<T>(ParameterInfo) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato.Retrieves a custom attribute of a specified type that is applied to a specified parameter. |
GetCustomAttribute<T>(Module) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un modulo specificato.Retrieves a custom attribute of a specified type that is applied to a specified module. |
GetCustomAttribute<T>(MemberInfo) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un membro specificato.Retrieves a custom attribute of a specified type that is applied to a specified member. |
GetCustomAttribute<T>(Assembly) |
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un assembly specificato.Retrieves a custom attribute of a specified type that is applied to a specified assembly. |
GetCustomAttribute(Assembly, Type)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un assembly specificato.Retrieves a custom attribute of a specified type that is applied to a specified assembly.
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);
static member GetCustomAttribute : System.Reflection.Assembly * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As Assembly, attributeType As Type) As Attribute
Parametri
- element
- Assembly
L'assembly da ispezionare.The assembly to inspect.
- attributeType
- Type
Tipo di attributo da cercare.The type of attribute to search for.
Restituisce
Attributo personalizzato che corrisponde a attributeType
o a null
se tale attributo non viene trovato.A custom attribute that matches attributeType
, or null
if no such attribute is found.
Eccezioni
element
o attributeType
è null
.element
or attributeType
is null
.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute(MemberInfo, Type)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un membro specificato.Retrieves a custom attribute of a specified type that is applied to a specified member.
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);
static member GetCustomAttribute : System.Reflection.MemberInfo * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As MemberInfo, attributeType As Type) As Attribute
Parametri
- element
- MemberInfo
Il membro da ispezionare.The member to inspect.
- attributeType
- Type
Tipo di attributo da cercare.The type of attribute to search for.
Restituisce
Attributo personalizzato che corrisponde a attributeType
o a null
se tale attributo non viene trovato.A custom attribute that matches attributeType
, or null
if no such attribute is found.
Eccezioni
element
o attributeType
è null
.element
or attributeType
is null
.
element
non è un costruttore, un metodo, una proprietà, un evento, un tipo o un campo.element
is not a constructor, method, property, event, type, or field.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute(Module, Type)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un modulo specificato.Retrieves a custom attribute of a specified type that is applied to a specified module.
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);
static member GetCustomAttribute : System.Reflection.Module * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As Module, attributeType As Type) As Attribute
Parametri
- element
- Module
Modulo da controllare.The module to inspect.
- attributeType
- Type
Tipo di attributo da cercare.The type of attribute to search for.
Restituisce
Attributo personalizzato che corrisponde a attributeType
o a null
se tale attributo non viene trovato.A custom attribute that matches attributeType
, or null
if no such attribute is found.
Eccezioni
element
o attributeType
è null
.element
or attributeType
is null
.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute(ParameterInfo, Type)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato.Retrieves a custom attribute of a specified type that is applied to a specified parameter.
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);
static member GetCustomAttribute : System.Reflection.ParameterInfo * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As ParameterInfo, attributeType As Type) As Attribute
Parametri
- element
- ParameterInfo
Il parametro da ispezionare.The parameter to inspect.
- attributeType
- Type
Tipo di attributo da cercare.The type of attribute to search for.
Restituisce
Attributo personalizzato che corrisponde a attributeType
o a null
se tale attributo non viene trovato.A custom attribute that matches attributeType
, or null
if no such attribute is found.
Eccezioni
element
o attributeType
è null
.element
or attributeType
is null
.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute(MemberInfo, Type, Boolean)
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un membro specificato e verifica facoltativamente i predecessori di tale membro.Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.
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);
static member GetCustomAttribute : System.Reflection.MemberInfo * Type * bool -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As MemberInfo, attributeType As Type, inherit As Boolean) As Attribute
Parametri
- element
- MemberInfo
Il membro da ispezionare.The member to inspect.
- attributeType
- Type
Tipo di attributo da cercare.The type of attribute to search for.
- inherit
- Boolean
true
per ispezionare i predecessori di element
; in caso contrario, false
.true
to inspect the ancestors of element
; otherwise, false
.
Restituisce
Attributo personalizzato che corrisponde a attributeType
o a null
se tale attributo non viene trovato.A custom attribute that matches attributeType
, or null
if no such attribute is found.
Eccezioni
element
o attributeType
è null
.element
or attributeType
is null
.
element
non è un costruttore, un metodo, una proprietà, un evento, un tipo o un campo.element
is not a constructor, method, property, event, type, or field.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute(ParameterInfo, Type, Boolean)
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato e verifica facoltativamente i predecessori di tale parametro.Retrieves a custom attribute of a specified type that is applied to a specified parameter, and optionally inspects the ancestors of that parameter.
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);
static member GetCustomAttribute : System.Reflection.ParameterInfo * Type * bool -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As ParameterInfo, attributeType As Type, inherit As Boolean) As Attribute
Parametri
- element
- ParameterInfo
Il parametro da ispezionare.The parameter to inspect.
- attributeType
- Type
Tipo di attributo da cercare.The type of attribute to search for.
- inherit
- Boolean
true
per ispezionare i predecessori di element
; in caso contrario, false
.true
to inspect the ancestors of element
; otherwise, false
.
Restituisce
Attributo personalizzato che corrisponde a attributeType
o a null
se tale attributo non viene trovato.A custom attribute matching attributeType
, or null
if no such attribute is found.
Eccezioni
element
o attributeType
è null
.element
or attributeType
is null
.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute<T>(ParameterInfo, Boolean)
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato e verifica facoltativamente i predecessori di tale parametro.Retrieves a custom attribute of a specified type that is applied to a specified parameter, and optionally inspects the ancestors of that parameter.
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;
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
Parametri di tipo
- T
Tipo di attributo da cercare.The type of attribute to search for.
Parametri
- element
- ParameterInfo
Il parametro da ispezionare.The parameter to inspect.
- inherit
- Boolean
true
per ispezionare i predecessori di element
; in caso contrario, false
.true
to inspect the ancestors of element
; otherwise, false
.
Restituisce
Attributo personalizzato che corrisponde a T
o a null
se tale attributo non viene trovato.A custom attribute that matches T
, or null
if no such attribute is found.
Eccezioni
element
è null
.element
is null
.
element
non è un costruttore, un metodo, una proprietà, un evento, un tipo o un campo.element
is not a constructor, method, property, event, type, or field.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute<T>(MemberInfo, Boolean)
Recupera un attributo personalizzato di un tipo specificato che viene applicato a un membro specificato e verifica facoltativamente i predecessori di tale membro.Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.
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;
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
Parametri di tipo
- T
Tipo di attributo da cercare.The type of attribute to search for.
Parametri
- element
- MemberInfo
Il membro da ispezionare.The member to inspect.
- inherit
- Boolean
true
per ispezionare i predecessori di element
; in caso contrario, false
.true
to inspect the ancestors of element
; otherwise, false
.
Restituisce
Attributo personalizzato che corrisponde a T
o a null
se tale attributo non viene trovato.A custom attribute that matches T
, or null
if no such attribute is found.
Eccezioni
element
è null
.element
is null
.
element
non è un costruttore, un metodo, una proprietà, un evento, un tipo o un campo.element
is not a constructor, method, property, event, type, or field.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute<T>(ParameterInfo)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un parametro specificato.Retrieves a custom attribute of a specified type that is applied to a specified parameter.
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;
static member GetCustomAttribute : System.Reflection.ParameterInfo -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As ParameterInfo) As T
Parametri di tipo
- T
Tipo di attributo da cercare.The type of attribute to search for.
Parametri
- element
- ParameterInfo
Il parametro da ispezionare.The parameter to inspect.
Restituisce
Attributo personalizzato che corrisponde a T
o a null
se tale attributo non viene trovato.A custom attribute that matches T
, or null
if no such attribute is found.
Eccezioni
element
è null
.element
is null
.
element
non è un costruttore, un metodo, una proprietà, un evento, un tipo o un campo.element
is not a constructor, method, property, event, type, or field.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute<T>(Module)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un modulo specificato.Retrieves a custom attribute of a specified type that is applied to a specified 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;
static member GetCustomAttribute : System.Reflection.Module -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As Module) As T
Parametri di tipo
- T
Tipo di attributo da cercare.The type of attribute to search for.
Parametri
- element
- Module
Modulo da controllare.The module to inspect.
Restituisce
Attributo personalizzato che corrisponde a T
o a null
se tale attributo non viene trovato.A custom attribute that matches T
, or null
if no such attribute is found.
Eccezioni
element
è null
.element
is null
.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute<T>(MemberInfo)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un membro specificato.Retrieves a custom attribute of a specified type that is applied to a specified member.
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;
static member GetCustomAttribute : System.Reflection.MemberInfo -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As MemberInfo) As T
Parametri di tipo
- T
Tipo di attributo da cercare.The type of attribute to search for.
Parametri
- element
- MemberInfo
Il membro da ispezionare.The member to inspect.
Restituisce
Attributo personalizzato che corrisponde a T
o a null
se tale attributo non viene trovato.A custom attribute that matches T
, or null
if no such attribute is found.
Eccezioni
element
è null
.element
is null
.
element
non è un costruttore, un metodo, una proprietà, un evento, un tipo o un campo.element
is not a constructor, method, property, event, type, or field.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Non è possibile caricare un tipo di attributo personalizzato.A custom attribute type cannot be loaded.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.
GetCustomAttribute<T>(Assembly)
Recupera una attributo personalizzato di un tipo specificato che viene applicato a un assembly specificato.Retrieves a custom attribute of a specified type that is applied to a specified 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;
static member GetCustomAttribute : System.Reflection.Assembly -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As Assembly) As T
Parametri di tipo
- T
Tipo di attributo da cercare.The type of attribute to search for.
Parametri
- element
- Assembly
L'assembly da ispezionare.The assembly to inspect.
Restituisce
Attributo personalizzato che corrisponde a T
o a null
se tale attributo non viene trovato.A custom attribute that matches T
, or null
if no such attribute is found.
Eccezioni
element
è null
.element
is null
.
È stato trovato più di un attributo richiesto.More than one of the requested attributes was found.
Commenti
Utilizzare il metodo di estensione GetCustomAttributes se si prevede più di un valore da restituire oppure verrà generata un'eccezione AmbiguousMatchException.Use the GetCustomAttributes extension method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.