Generic Types and Methods
- slide 8 : 21
Generic Types
C# supports generic classes, generic structs, generic interfaces, and generic delegate types
Template
C<T>
is not a type
C<T>
is a template from which a type can be constructed
T
is a
formal type parameter
Constructed type
The type constructed from a template
C<int>
,
C<string>
, and
D<
C<int>
>
int
,
string
, and
C<int>
are
actual type parameters
of
C
and
D
The ability to have generic types is known as
parametric polymorphism