I have regularly wondered why C# has not yet implemeted a Generic Enum.Parse
Lets say I have
enum MyEnum
{
Value1,
Value2
}
And from an XML file/DB entry I wish to to create an Enum.
MyEnum val = (MyEnum)Enum.Parse(typeof(MyEnum), "value1", true);
Could it not have been implemented as something like
MyEnum cal = Enum.Parse<MyEnum>("value1");
This might seem like a small issue, but it seems like an overlooked one.
Any thoughts?