非常简单的问题。但仍然无法解决。
我将消息传递给数组
feet nimantha 1 2 3 4 5 6 7 8 120827
我已经像这样声明了数组,
string[] arr1 = new string[10];
在那之后,我尝试了
string[] arr1 = new string[11];
但两者都向我展示了这个例外 -Index was outside the bounds of the array
代码在这里。
protected void Page_Load(object sender, EventArgs e) {
try {
string mobileNo = Request.QueryString["msisdn"];
int dest = int.Parse(Request.QueryString["shortcode"].ToString());
string messageIn = Request.QueryString["msg"];
string operatorNew = Request.QueryString["operator"];
// Label1.Text = "ok";
WriteToFile(mobileNo, dest, messageIn, operatorNew);
if (messageIn != null) {
string[] arr1 = new string[11];
arr1 = messageIn.Split(' ');
int size = arr1.Length;
string arrmsg = "";
foreach (string _element in arr1) {
if (arrmsg == "")
arrmsg = _element;
else {
arrmsg = arrmsg + "/" + _element;
}
}
}
} catch {}
}