Str and System.String conversion

Web Site  Methods
 
Str::Str (System::String __gc* source)
Available only for Windows with managed extensions (define STR_MCPP_FEATURES)

This constructor will initialize the object to contain a copy of the passed .NET string object.

The source parameter cannot be null.

 

 
Str::operator = (System::String)
Available only for Windows with managed extensions (define STR_MCPP_FEATURES)
 
const Str& operator= (System::String __gc* source)

The overloaded assignment operator will copy the passed .NET string into the Str object. The .NET string cannot be null.

 

 
Str::ToManaged
Available only for Windows with managed extensions (define STR_MCPP_FEATURES)
 
System::String __gc* ToManaged() const

This method will return a newly created .NET System.String containing a copy of the Str object data.

Example:

   String __gc* MyManagedClass::GetTextData() {
      Str obj1 (_T("Some text"));
      return obj1.ToManaged();
   }

 

See also: Str: Windows and .NET Specific, Managed C++ Overview