using System; using System.Collections.Generic; namespace DDD { public static class IntExtensions { public static string ToGold(this int gold) { return $"{gold} G"; } } public static class EnumExtensions { public static IEnumerable GetFlags(this T input) where T : Enum { foreach (T value in Enum.GetValues(typeof(T))) { int intValue = Convert.ToInt32(value); int inputValue = Convert.ToInt32(input); if (intValue != 0 && (inputValue & intValue) == intValue) yield return value; } } } }