Dictionary<string, string> f = new Dictionary<string, string>();
Dictionary<int, Dictionary<string, string>> lines = new Dictionary<int, Dictionary<string, string>>();
while ((line = sr.ReadLine()) != null)
{
lineArr = line.Split(',');
int x = 0;
foreach (string field in lineArr)
{
f.Add(keys[x], field);
x++;
}
lines.Add(lineIndex, f);
f.Clear();
lineIndex++;
字典 f 是临时的,我想将它的值存储在另一个字典中,但是一旦我清除()它,字典行中的值就会丢失,我想它会提供某种参考。知道如何解决这个问题吗?