我可以转换List<int>
吗?至 List<List<int>>
在 C# 中?
当我使用这样的构造时
List<int>element=new List<int>();
List<List<int>>superElement= new List<List<int>>(element);
我出错了,但我可以用其他方式做到这一点吗?
最佳答案
你可以这样做:
List<List<int>> superElement = new List<List<int>>();
superElement.Add(element);
关于c# - 将 List<int> 转换为 List<List<int>>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15921404/