C# Language Type Parameters (Interfaces)

Download C# Language for free

Example

Declaration:

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

Usage (in inheritance):

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> { ... }

Usage (as the type of a parameter):

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