interface IFolderOrItem where TFolderOrItem : FolderOrItem {} abstract class FolderOrItem {} class Folder : FolderOrItem {} abstract class It
The problem is that a cast does not work on the generic arguments, but on the class as a whole. Document inherits from Item, true, but IFolderOrItem< Document> does not inherit from IFolderOrItem< Item>, nor is related with it in any way.