public static T ToTypedInstance <T>(string key) where T : Enumeration, new() { var matchingItem = TypedEnumeration <T> .GetAllInstances().FirstOrDefault(i => i.Key == key); if (matchingItem == null) { var message = $"The key '{key}' is not found among enumerations of type {typeof(T)}"; throw new CircuitException(message); } return(matchingItem); }
public TypedEnumerationAndFlags(T initialState = null, bool populateAllEnumerations = false) : base(initialState, populateAllEnumerations ? TypedEnumeration <T> .GetAllInstances().Cast <Enumeration>().ToList() : null) { AllowMultipleSelections = false; }