将数组转换为字符串 [英] Convert an array to string

查看:85
本文介绍了将数组转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将此输出转换为字符串?

How do I make this output to a string?

List<string> Client = new List<string>();
foreach (string listitem in lbClients.SelectedItems)
{
    Client.Add(listitem);
}

推荐答案

您可以使用以下方法加入数组:

You can join your array using the following:

string.Join(",", Client);

然后您可以根据需要输出.您可以将逗号更改为所需的任意内容,空格,管道或其他内容.

Then you can output anyway you want. You can change the comma to what ever you want, a space, a pipe, or whatever.

这篇关于将数组转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆