The use of an enumeration that defines the positions of the planets in the solar system relative to the Sun : Enum : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » Enum »

 

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);

  }

}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» Enum