Abstract
Generic Types and Methods
 

 

This lecture is about type parametrization, also known as generics. We discuss both type parameterized classes, structs, methods, and delegates. We start with a motivational part, in which we understand why existing approaches are not good enough. During this part we develop several versions of a class for mathematical sets. This leads to a generic version of class Set in C#. As another example, we generalize the preexisting string class to String<T>, where T is IComparable. This leads, in a natural way, to a discussion of the contrast between IComparable and IComparable<T>. In the last part of the lecture we study generic methods and generic delegates.
 

Start
Table of contents