三次元のリストがあります。外側のリストは、授業期間の数を表しています。次の内側のリストは、学生の数を表します (リスト内の位置は、学生の一意の ID です)。最後のリストは、学生がその期間を受講しているコース ID です。
このリストをコピーする最も速い方法は何ですか?
私は試した
a.var = var.Select(x => x.ToList()).ToList().ToList();
しかし、それはうまくいきません。以下は私が使用しているものですが、もっとクリーンで高速な方法があると確信しており、その方法を学びたいと思います。
foreach (PERIOD period in periods)
{
a.var.Add(new List<List<int>>());
for (int student = 0; student < students.Count + 1; student++)
a.var[IntFromEnum(period)].Add(new List<int>());
foreach (Course course in periods[IntFromEnum(period)])
{
foreach (int student in course.students)
a.var[IntFromEnum(period)][student] = new List<int>(var[IntFromEnum(period)][student])
}
}