将数组转换为字符串 [英] Convert an array to string
本文介绍了将数组转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将此输出转换为字符串?
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屋!
查看全文