I am trying to teach myself C# using books.
I would like to display the name and the value of a collection of enums.
For instance:
Code:
public enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };
foreach (x in Days) {
Console.Write ("{0} {1} ", x.name, x.value);
}
should display: Sunday 0 Monday 1 Tuesday 2 Wednesday 3 Thursday 4 Friday 5 Saturday 6
What do I replace the "x in Days" with to get these values?
Thanks in Advance