c++ cli - How to return System::String handle from function? -


how return system::string handle function?

should use gcnew or not? example, 1 of 2 code examples below correct?

system::string ^managedoptimizer::getlogsolutionevolution() {     return gcnew system::string(myconstcharpointer); } 

or one:

system::string ^managedoptimizer::getlogsolutionevolution() {     return system::string(myconstcharpointer); } 

thanks

string reference type , if immutable. must use "gcnew" version... see also: string


Comments