谁知道将字符串 List
转换为 ArrayList
的最简单方法?
我尝试在代码之前设置 (ArrayList)
但这没有做任何事情。
最佳答案
当然:
ArrayList arrayList = new ArrayList(list);
之所以可行,是因为 List<T>
工具 ICollection
.
但是,我强烈建议您避免 ArrayList
(和其他非通用集合)如果可能的话。你能重构任何想要 ArrayList
的代码吗?改为使用通用集合?
关于c# - 将 List<string> 转换为 ArrayList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6610622/