Table of Contents

Class AttributeUtil

Namespace
DxFeed.Graal.Net.Utils
Assembly
DxFeed.Graal.Net.dll

Provides utility methods for retrieving custom Attribute.

public static class AttributeUtil
Inheritance
AttributeUtil
Inherited Members

Methods

GetCustomAttribute<T>(Type)

A generic version of GetCustomAttribute(MemberInfo, Type, bool) for Type. Retrieves a custom attribute applied to the type. Parameters specify the type with the custom attribute, the type of the custom attribute to search for. Doesn't look up the element's ancestors for custom attributes.

public static T? GetCustomAttribute<T>(Type type) where T : Attribute

Parameters

type Type

The type to which the custom attribute is applied.

Returns

T

A reference to the single custom attribute of type T that is applied to element, or null if there is no such attribute.

Type Parameters

T

The type, or a base type, of the custom attribute to search for.

Exceptions

ArgumentNullException

type is null.

AmbiguousMatchException

More than one of the requested attributes was found.

TypeLoadException

A custom attribute type cannot be loaded.

GetCustomAttribute<T>(Type, bool)

A generic version of GetCustomAttribute(MemberInfo, Type, bool) for Type. Retrieves a custom attribute applied to the type. Parameters specify the type with the custom attribute, the type of the custom attribute to search for, and whether to search ancestors of the type.

public static T? GetCustomAttribute<T>(Type type, bool inherit) where T : Attribute

Parameters

type Type

The type to which the custom attribute is applied.

inherit bool

If true, specifies to also search the ancestors of element for custom attributes.

Returns

T

A reference to the single custom attribute of type T that is applied to element, or null if there is no such attribute.

Type Parameters

T

The type, or a base type, of the custom attribute to search for.

Exceptions

ArgumentNullException

type is null.

AmbiguousMatchException

More than one of the requested attributes was found.

TypeLoadException

A custom attribute type cannot be loaded.