让我举个例子:
我有一些通用类/接口定义:
interface IGenericCar< T > {...}
我有另一个类/接口,我想与上面的类相关,例如:
interface IGarrage< TCar > : where TCar: IGenericCar< (**any type here**) > {...}
基本上,我希望我的通用 IGarrage 依赖于IGenericCar
,无论它是IGenericCar<int>
还是IGenericCar<System.Color>
,因为我对该类型没有任何依赖关系。