int to String under Managed C++
I have been doing a little managed C++ at work the last couple of days. Did you know you could do this:
System::String^ str = gcnew System::String("");
str += 5;
System::Console::WriteLine(str); // prints: 5
or simply:
System::String^ str = "";
str += 5;
System::Console::WriteLine(str); // prints: 5
or even:
System::String^ str;
str += 5;
System::Console::WriteLine(str); // prints: 5
The 5 is converted to a String for you. After working with C++ for so many years without a simple way to convert an int to a string this is nice. Might not seem like that big a deal, but these little things add up.
System::String^ str = gcnew System::String("");
str += 5;
System::Console::WriteLine(str); // prints: 5
or simply:
System::String^ str = "";
str += 5;
System::Console::WriteLine(str); // prints: 5
or even:
System::String^ str;
str += 5;
System::Console::WriteLine(str); // prints: 5
The 5 is converted to a String for you. After working with C++ for so many years without a simple way to convert an int to a string this is nice. Might not seem like that big a deal, but these little things add up.
