Skip to main content

Class EnumExtensions

Extension methods for enums.

Assembly: Dalamud.dll
View Source
Declaration
public static class EnumExtensions

Methods

GetAttributes<TAttribute>(Enum)

Gets attributes on an enum.

View Source
Declaration
public static IEnumerable<TAttribute> GetAttributes<TAttribute>(this Enum value) where TAttribute : Attribute
Returns

System.Collections.Generic.IEnumerable<<TAttribute>>: The enumerable of the attached attributes.

Parameters
TypeNameDescription
System.EnumvalueThe enum value that has an attached attribute.
Type Parameters
NameDescription
TAttributeThe type of attribute to get.

GetAttribute<TAttribute>(Enum)

Gets an attribute on an enum.

View Source
Declaration
public static TAttribute? GetAttribute<TAttribute>(this Enum value) where TAttribute : Attribute
Returns

<TAttribute>: The attached attribute, if any.

Parameters
TypeNameDescription
System.EnumvalueThe enum value that has an attached attribute.
Type Parameters
NameDescription
TAttributeThe type of attribute to get.

IsObsolete(Enum)

Gets an indicator if enum has been flagged as obsolete (deprecated).

View Source
Declaration
public static bool IsObsolete(this Enum value)
Returns

System.Boolean: Indicator if enum has been flagged as obsolete.

Parameters
TypeNameDescription
System.EnumvalueThe enum value that has an attached attribute.