April 2013
Intermediate to advanced
1700 pages
92h 51m
English
Generics allow developers to define types and methods that are parameterized with type parameters. Those parameters are ultimately filled in when such types or methods are used. Let’s concentrate on generic types for the time being, deferring treatment of methods until later.
When creating a generic type, whether it’s a class, struct, interface, or delegate, you’re adding one or more type parameters to the type declaration. On the other side of the picture, a user of the type can specify types for those parameters. Let’s take a look at an example to set the scene:
class List<T> { private T[] _elements; ... public T this[int i] { get { return _elements[i]; } set ...
Read now
Unlock full access