小编Pam*_* S.的帖子

将项添加到Dictionary返回System.IndexOutOfRangeException:索引超出了数组的范围

我有以下代码:

List<string> group = new List<string>();
List<int> groupInNumber = new List<int>();
Dictionary<string, List<string>> dicMyMap = new Dictionary<string, List<string>>();
Dictionary<string, int[]> a = new Dictionary<string, int[]>();
Dictionary<string, string[]> b = new Dictionary<string, string[]>();

private void SetData(out ExpandableListViewAdapter mAdapter)
    {
        int[] currentStatus = a["currentStatus"];
        string[] statusDesc = b["description"];
        int[] ticketID = a["ticketID"];

        foreach (int s in currentStatus)
        {
            if (s == 1)
            {
                group.Add(statusDesc[0]);
            }
            else if (s == 2)
            {
                group.Add(statusDesc[1]);
            }
            else if (s == 3)
            {
                group.Add(statusDesc[2]);
            }
            else …
Run Code Online (Sandbox Code Playgroud)

c# arrays dictionary indexoutofboundsexception

1
推荐指数
1
解决办法
268
查看次数