diff --git a/src/client/spark/view/Utility/EnumHelper.cs b/src/client/spark/view/Utility/EnumHelper.cs index b2043831b..3fc0c8926 100644 --- a/src/client/spark/view/Utility/EnumHelper.cs +++ b/src/client/spark/view/Utility/EnumHelper.cs @@ -10,9 +10,11 @@ using System.Reflection; namespace mbts.ui.utility { static class EnumHelper { - public static IEnumerable get_values() { return Enum.GetValues(typeof(T)).Cast(); } + public static IReadOnlyList get_values() => + EnumDescriptorStore.values; - public static IEnumerable get_values_except(params T[] except) { return get_values().Except(except); } + public static IEnumerable get_values_except(params T[] except) => + get_values().Except(except); public static IEnumerable get_values(Type t) { if (!t.IsEnum) { @@ -115,6 +117,8 @@ namespace mbts.ui.utility { static class EnumDescriptorStore { public static readonly EnumDescriptor descriptor; + public static readonly IReadOnlyList values = Enum.GetValues(typeof(T)).Cast().ToReadOnlyList(); + static EnumDescriptorStore() { Func has_flags; if (!typeof(T).IsEnum) {