I have an enumeration:
public enum MyColours
{
Red,
Green,
Blue,
Yellow,
Fuchsia,
Aqua,
Orange
}
and I have a s
You might also want to check out some of the suggestions in this blog post:
My new little friend, Enum
The post describes a way to create a very simple generic helper class which enables you to avoid the ugly casting syntax inherent with Enum.Parse
- instead you end up writing something like this in your code:
MyColours colour = Enum.Parse(stringValue);
Or check out some of the comments in the same post which talk about using an extension method to achieve similar.