Table of Contents

Class EnumHelper

Namespace
CMS.Helpers
Assembly
CMS.Helpers.dll

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
object
EnumHelper

Methods

GetDefaultValue(Type)

Gets the default value fo the specified enum type.

public static Enum GetDefaultValue(Type enumType)

Parameters

enumType Type

Enum 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 Type

Enum type

categories List<string>

Categories

Returns

IEnumerable<Enum>

Return enums with category attribute, with given category name.