Mega Code Archive
Assign int value to the first element in an enum
enum Planets
{
Mercury = 1,
Venus,
Earth,
Mars,
Jupiter,
Saturn,
Uranus,
Neptune,
Pluto
}
class MainClass
{
public static void Main()
{
System.Console.WriteLine("Position of Earth = " +(int) Planets.Earth);
System.Console.WriteLine("Planets.Earth = " +Planets.Earth);
}
}
Position of Earth = 3
Planets.Earth = Earth