参数数组

static void Main()
{
Console.WriteLine(Combine("test:\\", "abc", @"\def"));
Console.WriteLine(Combine(new string[]{"abc"," def" ," g"}));
Console.ReadKey();
}
static string Combine(params string[] paths)
{
var result = new StringBuilder();
foreach (var path in paths)
{
result.Append(path);
}
return result.ToString();
}
浙公网安备 33010602011771号