public static TEnum Parse <TEnum>(string s) where TEnum : Enum { try { return(EnumInfo.Get <TEnum>().Fields .Where(f => f.GetAttribute <CommandNameAttribute>()?.Command == s) .First().Value); } catch { throw new ArgumentException($"No command with name \"{s}\" found!"); } }