Table of Contents

StrictEnum Class

public static class StrictEnum
Inheritance
StrictEnum

Methods

BeautifyFieldName(string)

Reviced version of UnityEditor.ObjectNames.NicifyVariableName>

CustomDisplayNameFactory(Type, Func<Type, string, ulong, string>)

By default, EnumMemberAttribute is used to generate display name if exists, otherwise beautify field name. Note that factory method is used only once and automatically cleared after display name generation. (In Unity, InspectorName attribute is priority)

GetDisplayNameDictionary<TEnum>()
GetDisplayNames<TEnum>()

To customize display names, call CustomDisplayNameFactory(Type, Func<Type, string, ulong, string>) BEFORE calling other StrictEnum method.

GetFieldNameDictionary<TEnum>()
GetFieldNames<TEnum>()

Get enum entries as string array.

GetUnderlyingValuesAsMemory<TEnum>()
GetUnderlyingValues<TEnum>()

Get ulong representation of underlying values.

GetValueByDisplayName<TEnum>(ReadOnlySpan<char>, StringComparison, TEnum)
GetValueByFieldName<TEnum>(ReadOnlySpan<char>, StringComparison, TEnum)
GetValues<TEnum>()
IsInt32(Type)
IsInt32Convertible(Type)

Whether underlying value can be converted to int or not.

IsOrdinalFromZero(Type)
IsUnderlyingValueSigned(Type)
ToDisplayNameString<TEnum>(long)
ToDisplayNameString<TEnum>(ulong)
ToDisplayNameString<TEnum>(TEnum)
ToEnumValue<TEnum>(long)
ToEnumValue<TEnum>(ulong)
ToFieldNameString<TEnum>(long)
ToFieldNameString<TEnum>(ulong)
ToFieldNameString<TEnum>(TEnum)
ToLong<TEnum>(TEnum)
ToULong<TEnum>(TEnum)
TryFormat<TEnum>(TEnum, Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
TryGetValueByDisplayName<TEnum>(ReadOnlySpan<char>, out TEnum, StringComparison)
TryGetValueByFieldName<TEnum>(ReadOnlySpan<char>, out TEnum, StringComparison)
TryParse<TEnum>(ReadOnlySpan<char>, out TEnum, StringComparison, bool, string)

Always ignore empty entries for Flags enum type. (e.g. "Empty,,,Entries" will return 'Empty | Entries')