Show / Hide Table of Contents

Class CustomAttributeProviderExtensions

Provides a set of extension methods to make inspecting custom attributes easier.

Inheritance
System.Object
CustomAttributeProviderExtensions
Namespace: System.Reflection
Assembly: Nuqleon.Reflection.Virtualization.dll
Syntax
public static class CustomAttributeProviderExtensions : Object

Methods

GetCustomAttribute(IAssemblyIntrospectionProvider, Assembly, Type)

Gets the single custom attribute of the specified type applied to the specified assembly.

Declaration
public static Attribute GetCustomAttribute(this IAssemblyIntrospectionProvider provider, Assembly assembly, Type attributeType)
Parameters
Type Name Description
IAssemblyIntrospectionProvider provider

The reflection provider.

System.Reflection.Assembly assembly

The assembly to get the custom attribute from.

System.Type attributeType

The type for which the custom attribute is to be returned.

Returns
Type Description
System.Attribute

The single applied custom attribute instance, or null if no such attribute was found.

GetCustomAttribute(IMemberInfoIntrospectionProvider, MemberInfo, Type)

Gets the single custom attribute of the specified type applied to the specified member.

Declaration
public static Attribute GetCustomAttribute(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get the custom attribute from.

System.Type attributeType

The type for which the custom attribute is to be returned.

Returns
Type Description
System.Attribute

The single applied custom attribute instance, or null if no such attribute was found.

GetCustomAttribute(IMemberInfoIntrospectionProvider, MemberInfo, Type, Boolean)

Gets the single custom attribute of the specified type applied to the specified member.

Declaration
public static Attribute GetCustomAttribute(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType, bool inherit)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get the custom attribute from.

System.Type attributeType

The type for which the custom attribute is to be returned.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Attribute

The single applied custom attribute instance, or null if no such attribute was found.

GetCustomAttribute(IModuleIntrospectionProvider, Module, Type)

Gets the single custom attribute of the specified type applied to the specified module.

Declaration
public static Attribute GetCustomAttribute(this IModuleIntrospectionProvider provider, Module module, Type attributeType)
Parameters
Type Name Description
IModuleIntrospectionProvider provider

The reflection provider.

System.Reflection.Module module

The module to get the custom attribute from.

System.Type attributeType

The type for which the custom attribute is to be returned.

Returns
Type Description
System.Attribute

The single applied custom attribute instance, or null if no such attribute was found.

GetCustomAttribute(IParameterInfoIntrospectionProvider, ParameterInfo, Type)

Gets the single custom attribute of the specified type applied to the specified parameter.

Declaration
public static Attribute GetCustomAttribute(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, Type attributeType)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get the custom attribute from.

System.Type attributeType

The type for which the custom attribute is to be returned.

Returns
Type Description
System.Attribute

The single applied custom attribute instance, or null if no such attribute was found.

GetCustomAttribute(IParameterInfoIntrospectionProvider, ParameterInfo, Type, Boolean)

Gets the single custom attribute of the specified type applied to the specified parameter.

Declaration
public static Attribute GetCustomAttribute(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, Type attributeType, bool inherit)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get the custom attribute from.

System.Type attributeType

The type for which the custom attribute is to be returned.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Attribute

The single applied custom attribute instance, or null if no such attribute was found.

GetCustomAttribute<T>(IAssemblyIntrospectionProvider, Assembly)

Gets the single custom attribute of the specified type T applied to the specified assembly.

Declaration
public static T GetCustomAttribute<T>(this IAssemblyIntrospectionProvider provider, Assembly assembly)
    where T : Attribute
Parameters
Type Name Description
IAssemblyIntrospectionProvider provider

The reflection provider.

System.Reflection.Assembly assembly

The assembly to get the custom attribute from.

Returns
Type Description
T

The single applied custom attribute instance, or null if no such attribute was found.

Type Parameters
Name Description
T

The type of the custom attribute to retrieve.

GetCustomAttribute<T>(IMemberInfoIntrospectionProvider, MemberInfo)

Gets the single custom attribute of the specified type T applied to the specified member.

Declaration
public static T GetCustomAttribute<T>(this IMemberInfoIntrospectionProvider provider, MemberInfo member)
    where T : Attribute
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get the custom attribute from.

Returns
Type Description
T

The single applied custom attribute instance, or null if no such attribute was found.

Type Parameters
Name Description
T

The type of the custom attribute to retrieve.

GetCustomAttribute<T>(IMemberInfoIntrospectionProvider, MemberInfo, Boolean)

Gets the single custom attribute of the specified type T applied to the specified member.

Declaration
public static T GetCustomAttribute<T>(this IMemberInfoIntrospectionProvider provider, MemberInfo member, bool inherit)
    where T : Attribute
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get the custom attribute from.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
T

The single applied custom attribute instance, or null if no such attribute was found.

Type Parameters
Name Description
T

The type of the custom attribute to retrieve.

GetCustomAttribute<T>(IModuleIntrospectionProvider, Module)

Gets the single custom attribute of the specified type T applied to the specified module.

Declaration
public static T GetCustomAttribute<T>(this IModuleIntrospectionProvider provider, Module module)
    where T : Attribute
Parameters
Type Name Description
IModuleIntrospectionProvider provider

The reflection provider.

System.Reflection.Module module

The module to get the custom attribute from.

Returns
Type Description
T

The single applied custom attribute instance, or null if no such attribute was found.

Type Parameters
Name Description
T

The type of the custom attribute to retrieve.

GetCustomAttribute<T>(IParameterInfoIntrospectionProvider, ParameterInfo)

Gets the single custom attribute of the specified type T applied to the specified parameter.

Declaration
public static T GetCustomAttribute<T>(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter)
    where T : Attribute
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get the custom attribute from.

Returns
Type Description
T

The single applied custom attribute instance, or null if no such attribute was found.

Type Parameters
Name Description
T

The type of the custom attribute to retrieve.

GetCustomAttribute<T>(IParameterInfoIntrospectionProvider, ParameterInfo, Boolean)

Gets the single custom attribute of the specified type T applied to the specified parameter.

Declaration
public static T GetCustomAttribute<T>(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, bool inherit)
    where T : Attribute
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get the custom attribute from.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
T

The single applied custom attribute instance, or null if no such attribute was found.

Type Parameters
Name Description
T

The type of the custom attribute to retrieve.

GetCustomAttributes(IAssemblyIntrospectionProvider, Assembly)

Gets all the custom attributes for the specified assembly.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IAssemblyIntrospectionProvider provider, Assembly assembly)
Parameters
Type Name Description
IAssemblyIntrospectionProvider provider

The reflection provider.

System.Reflection.Assembly assembly

The assembly to get custom attributes for.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified assembly.

GetCustomAttributes(IAssemblyIntrospectionProvider, Assembly, Type)

Gets all the custom attributes for the specified assembly as specified by type.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IAssemblyIntrospectionProvider provider, Assembly assembly, Type attributeType)
Parameters
Type Name Description
IAssemblyIntrospectionProvider provider

The reflection provider.

System.Reflection.Assembly assembly

The assembly to get custom attributes for.

System.Type attributeType

The type for which the custom attributes are to be returned.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified assembly.

GetCustomAttributes(IMemberInfoIntrospectionProvider, MemberInfo)

Gets all the custom attributes for the specified member.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IMemberInfoIntrospectionProvider provider, MemberInfo member)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get custom attributes for.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified member.

GetCustomAttributes(IMemberInfoIntrospectionProvider, MemberInfo, Boolean)

Gets all the custom attributes for the specified member.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IMemberInfoIntrospectionProvider provider, MemberInfo member, bool inherit)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get custom attributes for.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified member.

GetCustomAttributes(IMemberInfoIntrospectionProvider, MemberInfo, Type)

Gets all the custom attributes for the specified member as specified by type.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get custom attributes for.

System.Type attributeType

The type for which the custom attributes are to be returned.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified member.

GetCustomAttributes(IMemberInfoIntrospectionProvider, MemberInfo, Type, Boolean)

Gets all the custom attributes for the specified member as specified by type.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType, bool inherit)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get custom attributes for.

System.Type attributeType

The type for which the custom attributes are to be returned.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified member.

GetCustomAttributes(IModuleIntrospectionProvider, Module)

Gets all the custom attributes for the specified module.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IModuleIntrospectionProvider provider, Module module)
Parameters
Type Name Description
IModuleIntrospectionProvider provider

The reflection provider.

System.Reflection.Module module

The module to get custom attributes for.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified module.

GetCustomAttributes(IModuleIntrospectionProvider, Module, Type)

Gets all the custom attributes for the specified module as specified by type.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IModuleIntrospectionProvider provider, Module module, Type attributeType)
Parameters
Type Name Description
IModuleIntrospectionProvider provider

The reflection provider.

System.Reflection.Module module

The module to get custom attributes for.

System.Type attributeType

The type for which the custom attributes are to be returned.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified module.

GetCustomAttributes(IParameterInfoIntrospectionProvider, ParameterInfo)

Gets all the custom attributes for the specified parameter.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get custom attributes for.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified parameter.

GetCustomAttributes(IParameterInfoIntrospectionProvider, ParameterInfo, Boolean)

Gets all the custom attributes for the specified parameter.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, bool inherit)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get custom attributes for.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified parameter.

GetCustomAttributes(IParameterInfoIntrospectionProvider, ParameterInfo, Type)

Gets all the custom attributes for the specified parameter as specified by type.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, Type attributeType)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get custom attributes for.

System.Type attributeType

The type for which the custom attributes are to be returned.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified parameter.

GetCustomAttributes(IParameterInfoIntrospectionProvider, ParameterInfo, Type, Boolean)

Gets all the custom attributes for the specified parameter as specified by type.

Declaration
public static IReadOnlyList<Attribute> GetCustomAttributes(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, Type attributeType, bool inherit)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get custom attributes for.

System.Type attributeType

The type for which the custom attributes are to be returned.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Attribute>

An array that contains the custom attributes for the specified parameter.

GetCustomAttributes<T>(IAssemblyIntrospectionProvider, Assembly)

Gets the custom attributes of the specified type T applied to the specified assembly.

Declaration
public static IReadOnlyList<T> GetCustomAttributes<T>(this IAssemblyIntrospectionProvider provider, Assembly assembly)
    where T : Attribute
Parameters
Type Name Description
IAssemblyIntrospectionProvider provider

The reflection provider.

System.Reflection.Assembly assembly

The assembly to get custom attributes from.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<T>

A read-only list of custom attribute instances.

Type Parameters
Name Description
T

The type of the custom attributes to retrieve.

GetCustomAttributes<T>(IMemberInfoIntrospectionProvider, MemberInfo)

Gets the custom attributes of the specified type T applied to the specified member.

Declaration
public static IReadOnlyList<T> GetCustomAttributes<T>(this IMemberInfoIntrospectionProvider provider, MemberInfo member)
    where T : Attribute
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get custom attributes from.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<T>

A read-only list of custom attribute instances.

Type Parameters
Name Description
T

The type of the custom attributes to retrieve.

GetCustomAttributes<T>(IMemberInfoIntrospectionProvider, MemberInfo, Boolean)

Gets the custom attributes of the specified type T applied to the specified member.

Declaration
public static IReadOnlyList<T> GetCustomAttributes<T>(this IMemberInfoIntrospectionProvider provider, MemberInfo member, bool inherit)
    where T : Attribute
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to get custom attributes from.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<T>

A read-only list of custom attribute instances.

Type Parameters
Name Description
T

The type of the custom attributes to retrieve.

GetCustomAttributes<T>(IModuleIntrospectionProvider, Module)

Gets the custom attributes of the specified type T applied to the specified module.

Declaration
public static IReadOnlyList<T> GetCustomAttributes<T>(this IModuleIntrospectionProvider provider, Module module)
    where T : Attribute
Parameters
Type Name Description
IModuleIntrospectionProvider provider

The reflection provider.

System.Reflection.Module module

The module to get custom attributes from.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<T>

A read-only list of custom attribute instances.

Type Parameters
Name Description
T

The type of the custom attributes to retrieve.

GetCustomAttributes<T>(IParameterInfoIntrospectionProvider, ParameterInfo)

Gets the custom attributes of the specified type T applied to the specified parameter.

Declaration
public static IReadOnlyList<T> GetCustomAttributes<T>(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter)
    where T : Attribute
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get custom attributes from.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<T>

A read-only list of custom attribute instances.

Type Parameters
Name Description
T

The type of the custom attributes to retrieve.

GetCustomAttributes<T>(IParameterInfoIntrospectionProvider, ParameterInfo, Boolean)

Gets the custom attributes of the specified type T applied to the specified parameter.

Declaration
public static IReadOnlyList<T> GetCustomAttributes<T>(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, bool inherit)
    where T : Attribute
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to get custom attributes from.

System.Boolean inherit

Indicates whether or not to retrieve attributes from a base type.

Returns
Type Description
System.Collections.Generic.IReadOnlyList<T>

A read-only list of custom attribute instances.

Type Parameters
Name Description
T

The type of the custom attributes to retrieve.

IsDefined(IAssemblyIntrospectionProvider, Assembly, Type)

Determines whether the custom attribute of the specified attributeType type or its derived types is applied to the specified assembly.

Declaration
public static bool IsDefined(this IAssemblyIntrospectionProvider provider, Assembly assembly, Type attributeType)
Parameters
Type Name Description
IAssemblyIntrospectionProvider provider

The reflection provider.

System.Reflection.Assembly assembly

The assembly to check the custom attribute on.

System.Type attributeType

The type of attribute to search for.

Returns
Type Description
System.Boolean

true if one or more instances of attributeType or its derived types are applied to the specified assembly; otherwise, false.

IsDefined(IMemberInfoIntrospectionProvider, MemberInfo, Type)

Determines whether the custom attribute of the specified attributeType type or its derived types is applied to the specified member.

Declaration
public static bool IsDefined(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType)
Parameters
Type Name Description
IMemberInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.MemberInfo member

The member to check the custom attribute on.

System.Type attributeType

The type of attribute to search for.

Returns
Type Description
System.Boolean

true if one or more instances of attributeType or its derived types are applied to the specified member; otherwise, false.

IsDefined(IModuleIntrospectionProvider, Module, Type)

Determines whether the custom attribute of the specified attributeType type or its derived types is applied to the specified module.

Declaration
public static bool IsDefined(this IModuleIntrospectionProvider provider, Module module, Type attributeType)
Parameters
Type Name Description
IModuleIntrospectionProvider provider

The reflection provider.

System.Reflection.Module module

The module to check the custom attribute on.

System.Type attributeType

The type of attribute to search for.

Returns
Type Description
System.Boolean

true if one or more instances of attributeType or its derived types are applied to the specified module; otherwise, false.

IsDefined(IParameterInfoIntrospectionProvider, ParameterInfo, Type)

Determines whether the custom attribute of the specified attributeType type or its derived types is applied to the specified parameter.

Declaration
public static bool IsDefined(this IParameterInfoIntrospectionProvider provider, ParameterInfo parameter, Type attributeType)
Parameters
Type Name Description
IParameterInfoIntrospectionProvider provider

The reflection provider.

System.Reflection.ParameterInfo parameter

The parameter to check the custom attribute on.

System.Type attributeType

The type of attribute to search for.

Returns
Type Description
System.Boolean

true if one or more instances of attributeType or its derived types are applied to the specified parameter; otherwise, false.

In This Article
Back to top Generated by DocFX