Get an enum's type, hex and value
using System;
enum EmployeeType : byte
{
Manager = 10,
Programmer = 1,
Contractor = 100,
Developer = 9
}
class MainClass
{
public static void Main(string[] args)
{
EmployeeType fred;
fred = EmployeeType.Developer;
Console.WriteLine("You are a {0}", fred.ToString());
Console.WriteLine("Hex value is {0}", Enum.Format(typeof(EmployeeType), fred, "x"));
Console.WriteLine("Int value is {0}", Enum.Format(typeof(EmployeeType), fred, "D"));
}
}
Output You are a Developer
Hex value is 09
Int value is 9
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
|
|