更新时间:2021-09-08 07:24:11
在C#4.0之前,泛型不是协变的.如果您不使用C#4.0,则可以像这样完成转换:
Before C# 4.0, generics are not covariant. If you are not using C# 4.0, you can accomplish this cast like this:
List<string[]> list = new List<string[]>();
//...Fill the list...
ICollection<object> collection = list.ConvertAll<object>(item => item as object);