写一个ss|dd|ff的练习。有问题求解!
如上所诉
static void Main(string[] args)
{
string[] s = { "ss", "dd", "ff" };
string t = "|";
string st = sum(s, t);
Console.Write(st);
Console.ReadKey();
}
static string sum(string[] x, string y)
{
string ss = "";
for (int i = 0; i < x.Length - 1; i++)
{
ss = ss + x[i] + y;
}
return ss;
}
写到了这运行结果: ss|dd| 请问最后一个元素怎么添加进去?
------解决方案--------------------
------解决方案--------------------