Why is this cast not possible?

后端 未结 4 557
一个人的身影
一个人的身影 2020-12-06 14:26
interface IFolderOrItem where TFolderOrItem : FolderOrItem {}

abstract class FolderOrItem {}

class Folder : FolderOrItem {}

abstract class It         


        
4条回答
  •  孤街浪徒
    2020-12-06 14:49

    As far as the compiler is concerened, IFolderOrItem & IFolderOrItem are two completely different types.

    Document may inherit Item, but IFolderOrItem does not inherit IFolderOrItem

    I'm relying on Marc or Jon to post links to the relevant portions of the C# spec.

提交回复
热议问题