Q:

Get enum name when value is known

I have an enum that has different colors in it.  I would like to pass some function an int and have it return the color name that is in the enum in that position. 
What's the way to do this? 

A:

return ((MyEnumClass)n).ToString();

A:

Another option is to use the GetName static method:
Enum. GetName(typeof(MyEnumClass), n);

This has the benefit that the code speaks for itself.  It should be obvious that it returns the name of the enum (which may be a bit difficult to realize when you use for example the ToString method). 

A:

In c# 6 you can use nameof. 
nameof(YourEnum. Something)

results in:
something

