String.Join 方法

String.Join 方法 (String, String[])
在指定 String 数组的每个元素之间串联指定的分隔符 String,从而产生单个串联的字符串
string [] array={AA,BB,CC};

string a = string.Join("-", array);

此时a="AA-BB-CC";

应用实例:

ViewData["EquiptdProblem"] = bm.GetList<t_EquiptdProblem>(p => p.MainWC == equip.Substring(0,3)).Select(p=>p.Problem).Distinct().ToList();

var EquiptdProblemList = ViewData["EquiptdProblem"] as IEnumerable<string>;
var selectListNew = new List<string>();
foreach (var list in EquiptdProblemList)
{
var aa = string.Format("<option>{0}</option>", list);
selectListNew.Add(string.Format("<option>{0}</option>", list));
}

message: '<p>other确认提交单么(Will you submit the request)?</p><table><tr><td>问题是什么(What is the problem)?</td><td><select id="preProblem" onchange="smallFunctionOther()">@Html.Raw(string.Join("",selectListNew))</select></td></tr><tr><td>具体问题(Specific Problem)</td><td><select id="SpeProblem"><option></option></select></td></tr><tr><td>问题描述(Problem Description)</td><td><input id="DesProblem" type="text" style=" 260px;" ></td></tr></table>',

原文地址:https://www.cnblogs.com/Depingblogs/p/14171823.html