C# Casting a List as List

前端 未结 11 1552
小鲜肉
小鲜肉 2020-12-09 15:35

Why can I not cast a List as List? Why does the following not work:

internal class ObjBase
   {
   }

int         


        
11条回答
  •  暖寄归人
    2020-12-09 16:23

    C# currently does not support variance for generic types. From what I've read, this will change in 4.0.

    See here for more information on variance in generics.

提交回复
热议问题