【问题标题】:How to convert char to string in C# [duplicate]如何在C#中将char转换为字符串[重复]
【发布时间】:2016-09-05 01:49:03
【问题描述】:

我想把char转成字符串,怎么办?

char[] buf;
Int32 dwsize;
buf = new char[256];
dwsize = 256;
if (Pxx_ATE.GetProjectName(DeviceId, decimal.ToInt32(up_ProIndex.Value), buf, dwsize))
{
  textBox_projName.Text = buf; //Here error,I want convert buf to string
}

【问题讨论】:

    标签: c#


    【解决方案1】:

    替换

    textBox_projName.Text = buf;
    

    textBox_projName.Text = new string(buf);
    

    【讨论】:

    • 我测试过,没问题:char[] buf = new char[256]; buf = "演示".ToCharArray(); textBox_projName.Text = new string(buf);
    猜你喜欢
    • 1970-01-01
    • 2021-05-03
    • 2012-10-03
    • 2015-07-04
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多