一维数组:
public IHttpActionResult Test(string strIDs)
{
string[] IDs;
if (!string.IsNullOrWhiteSpace(strIDs))
{
IDs= strIDs.Split(',');
}
else //为空就赋值为空数组
{
IDs= new string[0];
}
}
二维数组:
public IHttpActionResult Test(string strIDs)
{
string[,] IDs; //strIDs的长度不固定,所以二维数组的维度是不确定的
if (!string.IsNullOrWhiteSpace(strIDs))
{
IDs= TranStrToTwoArray(strIDs);
}
else
{
IDs= new string[0,0];
}
}
TranStrToTwoArray是自定义的字符串转二维数组方法,具体代码:https://blog.csdn.net/weixin_38091174/article/details/90598511