Illustrates the use of an enumeration that defines the orbital periods of the first four planets in days, using a base type of long

image_pdfimage_print

   
  
/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example2_12.cs illustrates the use of an enumeration
  that defines the orbital periods of the first four
  planets in days, using a base type of long
*/

public class Example2_121
{

  enum PlanetPeriods :long
  {
    Mercury = 88,
    Venus = 225,
    Earth = 365,
    Mars = 687
  }

  public static void Main()
  {

    System.Console.WriteLine("Orbital period for Mars = " +
      (long) PlanetPeriods.Mars + " days");

  }

}

           
         
    
     


This entry was posted in Data Types. Bookmark the permalink.