Changes before 1.0
janderson
askme at me.com
Sun Dec 3 13:52:55 PST 2006
> It would be helpful if the following code would work:
> enum TestEnum {
> Value1, Value2
> }
> writefln("%s", TestEnum.Value2);
It would be even more helpful if a .ToString() for enums was added. The
compiler could detect when it was used and only add those particular
enums to the binary. It would be most useful in scripting where you
want to convert a string to an enum. Which leads on to having a way of
converting a string to an enum directly.
string myenum = "Value1";
TestEnum result = myenum;
Ok getting its a bit complicated here and probably not worth the effort
however I deal with this type of code at least once a week. Maybe that
would be a 2.0 feature.
-Joel
More information about the Digitalmars-d
mailing list