Sunday, April 17, 2011

C++/CLI: std::string to System::String^

/// Copies the contents of a std::string into a managed string
/**
  * @preconditions
  *    None
  * @postconditions
  *    None
  * @param string
  *    The std::string to convert
  * @return
  *    A System::String^ created from the std::string
  * @throw
  *    This method will not throw
  */
static System::String^ toManagedString(const std::string& string)
{
     return gcnew System::String(string.c_str());
}

No comments:

Post a Comment