小编Mar*_*aru的帖子

如何在 C# 中深度复制包含列表的字典?

我需要制作一个Dictionary<string, List<int>>. 我试过:

Dictionary<string, List<int>> tmpStudents =
   new Dictionary<string, List<int>>(students);
Run Code Online (Sandbox Code Playgroud)

但操纵 中的值tmpStudents仍在改变 中的值students。中的列表似乎tmpStudents仍在引用中的列表students,但我不确定如何在不手动深度复制每个列表的情况下解决此问题。

c#

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

标签 统计

c# ×1