-
-
Save kg/2517485 to your computer and use it in GitHub Desktop.
Enums v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; // Hello | |
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