Table of Contents

Method GetMatchingCustomAttributes

Namespace
Xunit.Sdk
Assembly
xunit.v3.common.dll

GetMatchingCustomAttributes(Assembly, Type)

Gets all the custom attributes for the assembly that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this Assembly assembly, Type attributeType)

Parameters

assembly Assembly

The assembly to get custom attributes for.

attributeType Type

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the assembly

GetMatchingCustomAttributes(Assembly, string)

Gets all the custom attributes for the assembly that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this Assembly assembly, string assemblyQualifiedTypeName)

Parameters

assembly Assembly

The assembly to get custom attributes for.

assemblyQualifiedTypeName string

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the assembly

GetMatchingCustomAttributes(Attribute, Type)

Gets all the custom attributes for the attribute that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this Attribute attribute, Type attributeType)

Parameters

attribute Attribute

The attribute to get custom attributes for.

attributeType Type

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the attribute

GetMatchingCustomAttributes(Attribute, string)

Gets all the custom attributes for the attribute that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this Attribute attribute, string assemblyQualifiedTypeName)

Parameters

attribute Attribute

The attribute to get custom attributes for.

assemblyQualifiedTypeName string

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the attribute

GetMatchingCustomAttributes(MethodInfo, Type)

Gets all the custom attributes for the method that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this MethodInfo method, Type attributeType)

Parameters

method MethodInfo

The method to get custom attributes for.

attributeType Type

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the method

GetMatchingCustomAttributes(MethodInfo, string)

Gets all the custom attributes for the method that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this MethodInfo method, string assemblyQualifiedTypeName)

Parameters

method MethodInfo

The method to get custom attributes for.

assemblyQualifiedTypeName string

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the method

GetMatchingCustomAttributes(ParameterInfo, Type)

Gets all the custom attributes for the parameter that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this ParameterInfo parameter, Type attributeType)

Parameters

parameter ParameterInfo

The parameter to get custom attributes for.

attributeType Type

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the parameter

GetMatchingCustomAttributes(ParameterInfo, string)

Gets all the custom attributes for the parameter that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this ParameterInfo parameter, string assemblyQualifiedTypeName)

Parameters

parameter ParameterInfo

The parameter to get custom attributes for.

assemblyQualifiedTypeName string

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the parameter

GetMatchingCustomAttributes(Type, Type)

Gets all the custom attributes for the type that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this Type type, Type attributeType)

Parameters

type Type

The type to get custom attributes for.

attributeType Type

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the type

GetMatchingCustomAttributes(Type, string)

Gets all the custom attributes for the type that are of the given attribute type.

public static IReadOnlyCollection<Attribute> GetMatchingCustomAttributes(this Type type, string assemblyQualifiedTypeName)

Parameters

type Type

The type to get custom attributes for.

assemblyQualifiedTypeName string

The type of the attribute to find. Will accept attribute types that are concrete, closed generic, and open generic. When provided an open generic type (e.g., MyAttribute<>) it will return matching closed generic attributes (e.g., MyAttribute>int<)

Returns

IReadOnlyCollection<Attribute>

The matching attributes that decorate the type