enum DaysInMonth
{
Jan = 31, Feb = 28, Mar = 31, Apr = 30, May = 31, Jun = 30,
Jul = 31, Aug = 31, Sep = 30, Oct = 31, Nov = 30, Dec = 31
};
DaysInMonth dm = DaysInMonth.Dec;
Console.WriteLine($"Number of days in {dm} is {dm:D}");
を期待される結果を得ていない12月の日数が31のは、7月の日数を取得列挙
可能な重複は(http://stackoverflow.com/questions/8043027/non-unique-enum-values) – Steve
列挙は、一意の値で宣言されなければなりません。 – Pavvy