In C# you can declare an enum and once you have set its value call ToString on the variable and get a string representation of the value of the enum.
How do you do this in C++/CLI using a managed enum?
In C# you can declare an enum and once you have set its value call ToString on the variable and get a string representation of the value of the enum.
How do you do this in C++/CLI using a managed enum?
Isn't it the same syntax ?
MyEnum enumValue = MyEnum::Enum1;
Console::WriteLine(enumValue.ToString());
Look at this page of the book "Pro Visual C++/CLI and the .NET 3.5 Platform" in Google Books
"The ToString() method for enum prints out the enum name as a character string"
ToString() should return the name of the enum value. Furthermore, if you decorate the managed Enum with a [Flags] attribute, then eg Colour::Red | Colour::Blue
will ToString() as "Red, Blue". (This is from memory from Marcus Heege's book "Expert Visual C++/CLI: .NET for Visual C++ Programmers", not tried it myself)