Class TypeExtensions
- Namespace
- BSGameLib.Core
- Assembly
- BSGameLib.Core.dll
Extensions for reading attributes from types.
public static class TypeExtensions
- Inheritance
-
TypeExtensions
- Inherited Members
Methods
GetAttributeValue<TAttribute, TValue>(Type, Func<TAttribute, TValue>)
Returns the value valueSelector takes from the type's
TAttribute. The selector is called with null when the type has no
such attribute.
public static TValue GetAttributeValue<TAttribute, TValue>(this Type type, Func<TAttribute, TValue> valueSelector) where TAttribute : Attribute
Parameters
Returns
- TValue
Type Parameters
TAttributeTValue
GetAttribute<TAttribute>(Type)
Returns the first TAttribute on the type, or null if it has none.
public static TAttribute GetAttribute<TAttribute>(this Type type) where TAttribute : Attribute
Parameters
typeType
Returns
- TAttribute
Type Parameters
TAttribute
Remarks
Inherited attributes are included where the attribute allows inheritance.