Converting string to enumeration value
Questa posted a very usefull piece of code...
It's possible to convert a string representation of an enum back to an enum!
private enum MyEnumeration
{
FooBar,
Foo,
Bar
}
...
MyEnum foo = MyEnum.Foo;
string foobar = foo.ToString();
MyEnum bar = (MyEnum)Enum.Parse(typeof(MyEnum), foobar);
At the end of this code, the variable 'bar' has the MyEnum value 'Foo', just the way it's supposed to be...