StrictEnum Class
- Namespace
- SatorImaging.UnityFundamentals
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)
- GetDisplayNames<TEnum>()
To customize display names, call CustomDisplayNameFactory(Type, Func<Type, string, ulong, string>) BEFORE calling other StrictEnum method.
- GetFieldNames<TEnum>()
Get enum entries as string array.
- GetUnderlyingValues<TEnum>()
Get ulong representation of underlying values.
- IsInt32Convertible(Type)
Whether underlying value can be converted to int or not.
- 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'
)