Link to home
Start Free TrialLog in
Avatar of kvigor
kvigor

asked on

Enumeration Explanation of {0}

I was wondering I've seen enumeration values accessed and output in two ways one was by array/element notation and the other which included {0}, {1} could someone give me a detailed explanation of this from the following code example.

I understand that there's some value swopping going on but I'm not sure I understand why.  I've search msdn but to no avail.
using System;
public class EnumTest 
{
    enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};
 
    static void Main() 
    {
        int x = (int)Days.Sun;
        int y = (int)Days.Fri;
        Console.WriteLine("Sun = {0}", x);
        Console.WriteLine("Fri = {0}", y);
    }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of pivar
pivar
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kvigor
kvigor

ASKER

Very Well Done, I appreciate the responsiveness conciseness of your answers