Getting error while changing List value foreach (var sublist in declaration) { declaration.Add(new KeyValuePair(sublist.Key.ToString(), (sublist.Val