Table of Contents

Interface IGenericCustomAttributeProvider

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

Extends ICustomAttributeProvider with generic methods for attribute resolution.

public interface IGenericCustomAttributeProvider : ICustomAttributeProvider
Inherited Members
Extension Methods

Methods

GetCustomAttribute<TAttribute>(bool)

Retrieves a custom attribute defined on this member.

TAttribute? GetCustomAttribute<TAttribute>(bool inherit = true) where TAttribute : Attribute

Parameters

inherit bool

When true, look up the hierarchy chain for the inherited custom attribute.

Returns

TAttribute

A custom attribute that matches TAttribute, or null if no such attribute is found.

Type Parameters

TAttribute

The type of attribute to search for.

GetCustomAttributes<TAttribute>(bool)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

IEnumerable<TAttribute> GetCustomAttributes<TAttribute>(bool inherit = true) where TAttribute : Attribute

Parameters

inherit bool

When true, look up the hierarchy chain for the inherited custom attribute.

Returns

IEnumerable<TAttribute>

A collection of the custom attributes that are applied to element and that match TAttribute, or an empty collection if no such attributes exist.

Type Parameters

TAttribute

The type of attribute to search for.

IsDefined<TAttribute>(bool)

Checks if a particular custom attribute is defined on this member.

bool IsDefined<TAttribute>(bool inherit = true) where TAttribute : Attribute

Parameters

inherit bool

When true, look up the hierarchy chain for the inherited custom attribute.

Returns

bool

true if an instance of the attribute was found, or false otherwise.

Type Parameters

TAttribute

The type of attribute to search for.