If I assign the same number to the variables in the enum structure, which one will it call?
It varies according to the same number of values I give, 2 same value or 3 same value. Sometimes first variable comes back, sometimes last.
If I assign the same number to the variables in the enum structure, which one will it call?
It varies according to the same number of values I give, 2 same value or 3 same value. Sometimes first variable comes back, sometimes last.
First advice: Do not use enumeration for months. If you need name of the month you may use something like this
// to get the full month name
string _monthName = date.ToString("MMMM");
// to get the month name for 12th month according to locale
string _monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(12);
Second Advice: Prefer to use unique values for your enumerations. Otherwise you can only use them one way to resolve it. You may resolve value form string but if you have repeated values it is not possible to resolve string representation from value.
Just to make things simpler, Think of values as a uniqueId. As unique ids can not be duplicate. So, you must pass different values to avoid ambiguity.