Type Parameters (Classes)

Download c# eBook

Example

Declaration:

class MyGenericClass<T1, T2, T3, ...>
{
    // Do something with the type parameters.
}

Initialisation:

var x = new MyGenericClass<int, char, bool>();

Usage (as the type of a parameter):

void AnotherMethod(MyGenericClass<float, byte, char> arg) { ... }

Stats

Contributors: 1
2015-11-13
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook