定义一函数,输入值为一个二维字符数组([8,2]),返回值为一个字符串变量。
函数功能是对第i维的[i,0][i,1]中的字符串值进行处理。private string SearchLessons(string [,] selectSearchItems)
{
string whereSql="";
for (int i=0;i<selectSearchItems.GetLength(0);i++)
{
if (selectSearchItems[i][0]!="")
whereSql+=selectSearchItems[i][0]+"='"+selectSearchItems[i][1]+"' ";
}
return whereSql;
}
编译时,报selectSearchItems[i][0]有错,出错提示是:
[] 内索引数错误,应为“2”