using System; using Microsoft.Xna.Framework.Input; namespace MLEM.Misc { /// /// A helper class that allows easier usage of values. /// public static class EnumHelper { /// /// All values of the enum. /// public static readonly Buttons[] Buttons = EnumHelper.GetValues(); /// /// All values of the enum. /// public static readonly Keys[] Keys = EnumHelper.GetValues(); /// /// Returns an array containing all of the values of the given enum type. /// Note that this method is a version-independent equivalent of .NET 5's Enum.GetValues<TEnum>. /// /// The type whose enum to get /// An enumerable of the values of the enum, in declaration order. public static T[] GetValues() where T : struct, Enum { #if NET6_0_OR_GREATER return Enum.GetValues(); #else return (T[]) Enum.GetValues(typeof(T)); #endif } } }