似乎列表对象不能存储在C#中的列表变量中,甚至不能以这种方式显式转换.
List<string> sl = new List<string>();
List<object> ol;
ol = sl;
中的结果不能隐式将类型System.Collections.Generic.List<string>
转换为System.Collections.Generic.List<object>
然后...
List<string> sl = new List<string>();
List<object> ol;
ol = (List<object>)sl;
导致无法将类型System.Collections.Generic.List<string>
转换为System.Collections.Generic.List<object>
当然,你可以从字符串列表中提取所有内容,然后一次将其放回一个列表中,但这是一个相当复杂的解决方案.