Class EnumHelper
Provides helper methods for working with the Enum
types.
[Obsolete("Method was not intended for public use and will be removed in the next version.")]
[ObsoleteSince(29, 6)]
public static class EnumHelper
- Inheritance
-
objectEnumHelper
Methods
GetDefaultValue(Type)
Gets the default value fo the specified enum type.
public static Enum GetDefaultValue(Type enumType)
Parameters
enumType
TypeEnum type
Returns
- Enum
Returns the default enum value, if it is specified using the EnumDefaultValueAttribute. Otherwise returns the first declared enum value.
GetDefaultValue<TEnum>()
Gets the default value fo the specified enum type.
public static TEnum GetDefaultValue<TEnum>() where TEnum : struct, IConvertible, IComparable, IFormattable
Returns
- TEnum
Returns the default enum value, if it is specified using the EnumDefaultValueAttribute. Otherwise returns the first declared enum value.
Type Parameters
TEnum
Enum type
GetEnumsByCategories(Type, List<string>)
Gets enums with category attribute, which have given category name.
public static IEnumerable<Enum> GetEnumsByCategories(Type enumType, List<string> categories)
Parameters
enumType
TypeEnum type
categories
List<string>Categories
Returns
- IEnumerable<Enum>
Return enums with category attribute, with given category name.