数组转换为字符串? C# [英] Convert array to string? c#
本文介绍了数组转换为字符串? C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让我这个输出到一个字符串?
列表<串GT;客户端=新的List<串GT;();
的foreach(在lbClients.SelectedItems字符串列表项)
{
Client.Add(列表项);
}
解决方案
您可以使用以下加入您的数组:
的string.join(,客户端);
然后就可以输出反正你想要的。您可以逗号改为你想要什么都,空间,管道,或什么的。
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.
这篇关于数组转换为字符串? C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文