zip's

while(true) { Write it down; Think about it; Refine it; Sleep(); }

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

直接 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)

-

posted on 2011-06-08 10:55  zip's  阅读(1683)  评论(0编辑  收藏  举报