Lecture overview -- Keyboard shortcut: 'u'  Previous page: Generic structs -- Keyboard shortcut: 'p'  Next page: Generic equality interfaces -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Generic Types and Methods - slide 14 : 21

Generic interfaces: IComparable<T>
We illustrate generic interfaces with IComparable
IComparable-non-generic.cs
A reproduction of the non-generic interface IComparable.
IComparable.cs
A reproduction of the generic interface IComparable<T>.
die-random.cs
A class Die that implements IComparable.
die-random.cs
A class Die that implements IComparable<T>.
The implementation of the generic interface is more type safe and less clumsy than the implementation of the non-generic solution