TypeDelegator.GetCustomAttributes Method

Definition

Returns all the custom attributes defined for this type.

Overloads

GetCustomAttributes(Boolean)

Returns all the custom attributes defined for this type, specifying whether to search the type's inheritance chain.

GetCustomAttributes(Type, Boolean)

Returns an array of custom attributes identified by type.

GetCustomAttributes(Boolean)

Source:
TypeDelegator.cs
Source:
TypeDelegator.cs
Source:
TypeDelegator.cs

Returns all the custom attributes defined for this type, specifying whether to search the type's inheritance chain.

C#
public override object[] GetCustomAttributes(bool inherit);

Parameters

inherit
Boolean

Specifies whether to search this type's inheritance chain to find the attributes.

Returns

Object[]

An array of objects containing all the custom attributes defined for this type.

Exceptions

A custom attribute type cannot be loaded.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

GetCustomAttributes(Type, Boolean)

Source:
TypeDelegator.cs
Source:
TypeDelegator.cs
Source:
TypeDelegator.cs

Returns an array of custom attributes identified by type.

C#
public override object[] GetCustomAttributes(Type attributeType, bool inherit);

Parameters

attributeType
Type

An array of custom attributes identified by type.

inherit
Boolean

Specifies whether to search this type's inheritance chain to find the attributes.

Returns

Object[]

An array of objects containing the custom attributes defined in this type that match the attributeType parameter, specifying whether to search the type's inheritance chain, or null if no custom attributes are defined on this type.

Exceptions

attributeType is null.

A custom attribute type cannot be loaded.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1