.net - 托管 C++/CLI 中的 System::String 连接

标签 .net string system command-line-interface

我在我们的一些代码中看到了以下构造:

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/

相关文章:

.net - 如何从 .net core 调用 ibm watson api

C 更改传递给函数的字符串不起作用

java - 逐字符翻译字符串

c++ - 如何只从几个 C++ 字符串中获取第一个单词?

c# - TypeDescriptor CanConvertFrom 错误?还是我做错了?

c# - 如何将 NameValueCollection 转换为 Hashtable

c# - Google API - Calendar API 正在运行,但 Gmail API 返回 '' unauthorized_client”

.net - Azure 中的 session 超时

c - execlp 给出中止陷阱 6

c - 如何在 execl() 函数中更改时区 (TZ=UTC) 输出。