Skip to content

Instantly share code, notes, and snippets.

@TryJSIL
Created April 27, 2012 12:44
Show Gist options
  • Save TryJSIL/2508919 to your computer and use it in GitHub Desktop.
Save TryJSIL/2508919 to your computer and use it in GitHub Desktop.
Enums
using System;
public static class Program {
public enum SimpleEnum {
A,
B = 3,
C,
D = 10
}
public enum ByteEnum : byte {
A,
B = 3,
}
public static void Main (string[] args) {
Console.WriteLine("{0} {1} {2}", SimpleEnum.A, SimpleEnum.B, SimpleEnum.C);
Console.WriteLine("{0} {1}", ByteEnum.A, ByteEnum.B);
Console.WriteLine("{0} {1} {2}", (int)SimpleEnum.A, (int)SimpleEnum.B, (int)SimpleEnum.C);
Console.WriteLine("{0} {1}", (int)ByteEnum.A, (int)ByteEnum.B);
Console.WriteLine("{0} {1}", Enum.Parse(typeof(SimpleEnum), "C"), Enum.Parse(typeof(SimpleEnum), "3"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment