The use of an enumeration that defines the positions of the planets in the solar system relative to the Sun

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy
Publisher: Sybex;
ISBN: 0782129110
*/
/*
Example2_10.cs illustrates the use of an enumeration
that defines the positions of the planets in
the solar system relative to the Sun
*/
public class Example2_10
{
enum Planets
{
Mercury = 1,
Venus,
Earth,
Mars,
Jupiter,
Saturn,
Uranus,
Neptune,
Pluto
}
public static void Main()
{
System.Console.WriteLine("Position of Earth = " +
(int) Planets.Earth);
System.Console.WriteLine("Planets.Earth = " +
Planets.Earth);
}
}
Related examples in the same category