直接 cast 即可
System::String^ s1 = gcnew System::String("How easy!");
CString s = (CString)s1;
看 CStringT 的源代码,CStringT 中有一个传入 System String 的构造函数:
// This template will compile only for
// class SystemString == System::String
#if defined(__cplusplus_cli)
template <class SystemString>
CStringT( SystemString^ pString ) :
CThisSimpleString( StringTraits::GetDefaultManager() )
{
cli::pin_ptr<const System::Char> pChar = PtrToStringChars( pString );
const wchar_t *psz = pChar;
*this = psz;
}
#elif defined(_MANAGED)
-