Using a base type of long when defining an enum
enum PlanetPeriods :long
{
Mercury = 8,
Venus = 2,
Earth = 3,
Mars = 6
}
class MainClass
{
public static void Main()
{
System.Console.WriteLine("Orbital period for Mars = " + (long) PlanetPeriods.Mars + " days");
}
}
Output Orbital period for Mars = 6 days
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
|