Illustrates the use of an enumeration that defines the orbital periods of the first four planets in days, using a base type of long : Enum : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » Enum »

 

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









    

/*
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");

  }

}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» Enum