How can you enumerate an enum in C#?
enum
E.g. the following code does not compile:
public enum Suit {
LINQ Generic Way:
public static Dictionary ToList() where T : struct => ((IEnumerable)Enum.GetValues(typeof(T))).ToDictionary(value => Convert.ToInt32(value), value => value.ToString());
Usage:
var enums = ToList();