internal static IEnumerable <String> ConvertFlagsToString(String method, VndbFlags flags) { var type = typeof(VndbFlags); var typeInfo = type.GetTypeInfo(); foreach (Enum value in Enum.GetValues(type)) { if (!flags.HasFlag(value)) { continue; } var fi = typeInfo.GetDeclaredField(value.ToString()); var identity = fi.GetCustomAttribute <FlagIdentityAttribute>(); if (identity == null) { continue; } if ((method == Constants.GetStaffCommand || method == Constants.GetCharacterCommand) && (VndbFlags)value == VndbFlags.VisualNovels) { yield return($"{identity.Identity}s"); // Ugly hack to work around *two* vn(s) flags } else { yield return(identity.Identity); } } }