using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AppendStringDemo
{
class Program
{
#region AppendString
public static string AppendString(params string[] strList)
{
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < strList.Length; i++)
{
strBuilder = strBuilder.Append(strList[i]);
}
return strBuilder.ToString();
}
#endregion
static void Main(string[] args)
{
String str1 = "hello";
String str2 = "world";
String str3 = "hehe";
String str4 = "ByeBye";
String str1_4=AppendString(str1, str2, str3, str4);
Console.WriteLine(str1_4);
String str_args = AppendString(args);
Console.WriteLine(str_args);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
AppendStringDemo.exe a b c d e f g
helloworldheheByeBye
abcdefg
///////////////////////////////////////////////////////////////////////
namespace AppendStringDemo
{
internal
class Program
{
public
static string
AppendString(params
string[] strList)
{
StringBuilder strBuilder =
new StringBuilder();
for (int i =
0; i < strList.Length; i++)
{
strBuilder = strBuilder.Append(strList[i]);
}
return strBuilder.ToString();
}
private
static void
Main(string[] args)
{
string str =
"hello";
string str2 =
"world";
string str3 =
"hehe";
string str4 =
"ByeBye";
string str1_4 = Program.AppendString(new
string[]
{
str,
str2,
str3,
str4
});
Console.WriteLine(str1_4);
string str_args = Program.AppendString(args);
Console.WriteLine(str_args);
}
}
}