非常に単純な問題ですが、まだ解決できません。
配列にメッセージを渡します
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 {}
}