C# Generics Inheritance Problem

前端 未结 5 537
囚心锁ツ
囚心锁ツ 2020-12-09 19:24

I\'d like to add different types of objects derived from one class with generics into a List of base type. I get this compile error

Error   2   Argument 1: c         


        
5条回答
  •  一生所求
    2020-12-09 19:40

    An article on co and contra-variance in generics:

    http://msdn.microsoft.com/en-us/library/dd799517.aspx

提交回复
热议问题