Class EnumHelper
Assembly: Estrelica.Utility.dll
Syntax
[DoNotObfuscateType]
public static class EnumHelper
Methods
Declaration
public static TEnum AndBits<TEnum>(this TEnum x, TEnum y) where TEnum : struct, IConvertible, IComparable, IFormattable
Parameters
Returns
Type Parameters
Declaration
public static TEnum? CastNullable<TEnum>(this object value) where TEnum : struct, Enum
Parameters
Returns
Type Parameters
Gets an attribute on an enum field value
Declaration
public static T GetAttributeOfType<T>(this Enum enumVal) where T : Attribute
Parameters
Enum
enumVal
The enum value
|
Returns
T
The attribute of type T that exists on the enum value
|
Type Parameters
T
The type of the attribute you want to retrieve
|
Examples
string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;
Declaration
public static bool HasFlags<TEnum>(this TEnum x, TEnum y) where TEnum : struct, IConvertible, IComparable, IFormattable
Parameters
Returns
Type Parameters
Declaration
public static bool In<TEnum>(this TEnum x, params TEnum[] y)
Parameters
Returns
Type Parameters
Declaration
public static bool IsEmpty<TEnum>(this TEnum x) where TEnum : struct, IConvertible, IComparable, IFormattable
Parameters
Returns
Type Parameters
Declaration
public static TEnum Max<TEnum>(TEnum a, TEnum b) where TEnum : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static TEnum Min<TEnum>(TEnum a, TEnum b) where TEnum : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static TEnum OrBits<TEnum>(this TEnum x, TEnum y) where TEnum : struct, IConvertible, IComparable, IFormattable
Parameters
Returns
Type Parameters
Declaration
public static TEnum ParseIfNotNull<TEnum>(this string value, TEnum defaultIfNull = default)
Parameters
string
value
|
TEnum
defaultIfNull
|
Returns
Type Parameters
Declaration
public static TEnum? ParseNullable<TEnum>(this string value) where TEnum : struct, Enum
Parameters
Returns
Type Parameters