enum to string

MIURA Masahiro echochamber at gmail.com
Tue Mar 10 18:09:37 PDT 2009


In D2:

enum Shape: string
{
    Square = "Square",
    Circle = "Circle",
}

void main()
{
    assert(cast(string) Shape.Square == "Square");
}


More information about the Digitalmars-d-learn mailing list