不用循环,怎么把List<string>合并成一个字符串?
比如List<string> list = new List<string>() { "a", "b", "c" };怎么才能不用循环得到字符串“abc”?
比如List<string> list = new List<string>() { "a", "b", "c" };怎么才能不用循环得到字符串“abc”?
解决方案 »
- 请问一下,这个用图象识别怎么识别出来,C# 最好是用Tesseract
- 系统是ASP做的,但现在用.net做了个界面,需要挂在系统里,当点连接后报错,无法显示!急
- webbrower做的浏览器,加载出来的页面的关闭按钮怎么添加?
- VB.net转C#问题
- 简单switch 语句错误
- 各位高手,论坛超难度问题,大家看看,在winForm中用DataGrid怎么样去实如论坛浏览贴子一样的效果?
- 主窗体与子窗体交互问题?
- asp.net读取EXCEl中单元格的格式不同读不到里面的数据
- 为什么不识别HttpFlieCollection?我已经using System.IO;了啊
- C#验证Email是否真正存在
- voip
- toolStrip1控件上的所有项目
*****************************************************************************
http://feiyun0112.cnblogs.com/
/// <summary>
/// 把一个字符串列表用特殊的标记串接成一个新字符串
/// </summary>
/// <param name="textList">要输出的字符串数组</param>
/// <param name="connector">要串联的间隔符</param>
/// <param name="isIgnoreEmptyEntries">是否忽略Empty或Null项</param>
/// <returns></returns>
public static string ToString(this IEnumerable<string> textList, string connector = "<br/>", bool isIgnoreEmptyEntries = false)
{
StringBuilder sb = new StringBuilder();
foreach (var item in textList)
{
if (isIgnoreEmptyEntries && string.IsNullOrWhiteSpace(item))
{
continue;
}
if (sb.Length > 0)
{
sb.Append(connector);
}
sb.Append(item);
}
return sb.ToString();
}List<string> list = new List<string>() { "a", "b", "c" };
this.lbl_AppGroup.Text = list.ToString();