Enum Values
/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
public class EnumValues
{
// declare the enumeration
enum Temperatures
{
WickedCold = 0,
FreezingPoint = 32,
LightJacketWeather = 60,
SwimmingWeather = 72,
BoilingPoint = 212,
}
static void Main( )
{
System.Console.WriteLine("Freezing point of water: {0}",
(int) Temperatures.FreezingPoint );
System.Console.WriteLine("Boiling point of water: {0}",
(int) Temperatures.BoilingPoint );
}
}
Related examples in the same category