关于params关键字
解决方法:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
string[] sArray=new string[3];
sArray[0]="aaa";
sArray[1]="bbb";
sArray[2]="ccc";
Method1(sArray);
// Method1("aaa","bbb","ccc"); //error
Method2(sArray);
Method2("aaa","bbb","ccc");
}
private void Method1(string[] s)
{
string temp="";
foreach(string e in s)
{
temp+=e;
}
this.TextBox1.Text =temp;
}
private void Method2(params string[] s)
{
string temp="";
foreach(string e in s)
{
temp+=e;
}
this.TextBox2.Text =temp;
}
