型別引數(介面)
宣告:
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) { ... }