Class EnumExtensions
- Namespace
- FishMMO.Shared
- Assembly
- FishMMO-SharedUtility.dll
Extension methods and caching utilities for working with enums.
public static class EnumExtensions
- Inheritance
-
EnumExtensions
- Inherited Members
Methods
ToArray<T>()
Returns an array of all values of the specified enum type. Uses a ConcurrentDictionary<TKey, TValue> to cache the results so that reflection is only performed once per enum type. Thread-safe without requiring an explicit lock.
NOTE: A new clone is returned on each call so callers cannot mutate the cached copy.
public static T[] ToArray<T>() where T : Enum
Returns
- T[]
A copied array of all enum values.
Type Parameters
TThe enum type.