M
Martin Bischoff
Hi,
is it possible to define an implicit user-defined type conversion
operator for enums?
I'd like to convert my enum to an int without an explicit cast, e.g.
something like this:
------
public enum MyEnum : int
{
One = 1, Two, Three
}
....
MyEnum e = MyEnum.Two;
int i = (int)e; // this works
int j = e; // is it possible to achieve this
is it possible to define an implicit user-defined type conversion
operator for enums?
I'd like to convert my enum to an int without an explicit cast, e.g.
something like this:
------
public enum MyEnum : int
{
One = 1, Two, Three
}
....
MyEnum e = MyEnum.Two;
int i = (int)e; // this works
int j = e; // is it possible to achieve this