类型参数(接口)

声明:

interface IMyGenericInterface<T1, T2, T3, ...> { ... }

用法(继承):

class ClassA<T1, T2, T3> : IMyGenericInterface<T1, T2, T3> { ... }

class ClassB<T1, T2> : IMyGenericInterface<T1, T2, int> { ... }

class ClassC<T1> : IMyGenericInterface<T1, char, int> { ... }

class ClassD : IMyGenericInterface<bool, char, int> { ... }

用法(作为参数的类型):

void SomeMethod(IMyGenericInterface<int, char, bool> arg) { ... }