Skip to content

Instantly share code, notes, and snippets.

@hsinjungwu
Created November 10, 2014 10:21
Show Gist options
  • Select an option

  • Save hsinjungwu/b83b508bcb213474b0d9 to your computer and use it in GitHub Desktop.

Select an option

Save hsinjungwu/b83b508bcb213474b0d9 to your computer and use it in GitHub Desktop.
c# Example
//ref : http://stackoverflow.com/a/105402
using System;
public class CSharpLab
{
public enum myColor
{
gray = 0,
grey = 0,
black,
white
}
public static void Test()
{
foreach (myColor c in (myColor[]) Enum.GetValues(typeof(myColor)))
Console.WriteLine(c.ToString());
// output : grey, grey, black, white
foreach (string name in Enum.GetNames(typeof(myColor)))
Console.WriteLine(name);
// output : gray, grey, black, white
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment