Mega Code Archive

 
Categories / C# / Data Types
 

Illustrates the use of an enumeration that defines the orbital periods of the first four planets in days

/* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110 */ /*   Example2_11.cs illustrates the use of an enumeration   that defines the orbital periods of the first four   planets in days */ public class Example2_111 {   enum PlanetPeriods   {     Mercury = 88,     Venus = 225,     Earth = 365,     Mars = 687   }   public static void Main()   {     System.Console.WriteLine("Orbital period for Mars = " +       (int) PlanetPeriods.Mars + " days");   } }