ToEnum Extension Method
namespace Extensions {
static public class Extensions {
static public T ToEnum<T>(this object value) {
var result = (T) System.Enum.ToObject(typeof(T), value);
return (T)result;
}
static public T ToEnum<T>(this string value) {
var result = System.Enum.Parse(typeof(T), value);
return (T)result;
}
}
}