Array declared:
public static string[] topUsers = new string[65536]; And this code works with it:
public async void GetGlobalTop() { gtlist.Items.Clear(); string answer = await Consts.URL_GETTOP.PostUrlEncodedAsync(new { accountID = accountID, type = "relative", gjp = gjp }).ReceiveString(); if (answer != "") { Regex reg = new Regex("|"); if (reg.IsMatch(answer)) { string[] users = answer.Split(new char[] { '|' }); int i = 0; foreach (string user in users) { string[] data = user.Split(new char[] { ':' }); Temp.topUsers[i] = data[1] + ":" + data[21]; i++; if (data[1] != "") { gtlist.Items.Add((string)data[1]); } } } else { string[] data = answer.Split(new char[] { ':' }); Temp.topUsers[0] = data[1] + ":" + data[21]; if (data[1] != "") { gtlist.Items.Add((string)data[1]); } } } else { Msg.ShowErrMessage("Ошибка", Consts.ERR); } An exception appears on this line:
Temp.topUsers[i] = data[1] + ":" + data[21]; What could be the problem?
topUsersanddataarrays when an exception occurs. - Pavel Mayorov