我在我们的一些代码中看到了以下构造:
String^ channelName = gcnew String(pChannelData->UserLabel) + "_" + iChannelNameIndex;
这合法吗?这看起来像是在托管堆(对于channelName)上为pChannelData->UserLabel大小的System::String进行的分配,但不会考虑额外的字符。
最佳答案
是的,使用 + 来连接 System::String ^ 是可以的。
关于.net - 托管 C++/CLI 中的 System::String 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23139887/