Table of Contents

Method SafeGetCustomAttribute

Namespace
Anvil.API
Assembly
NWN.Anvil.dll

SafeGetCustomAttribute<T>(MemberInfo, bool)

Safely gets a custom attribute of type T without triggering type resolution exceptions.

public static T? SafeGetCustomAttribute<T>(this MemberInfo memberInfo, bool inherit = true)

Parameters

memberInfo MemberInfo

The member to inspect for the attribute.

inherit bool

True to include attributes inherited from base types.

Returns

T

The attribute instance if found; otherwise null.

Type Parameters

T

The attribute type to resolve.