Lecture overview -- Keyboard shortcut: 'u'  Previous page: Generic structs -- Keyboard shortcut: 'p'  Next page: Generic equality interfaces -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 14 : 21
Object-oriented Programming in C#
Generic Types and Methods
Generic interfaces: IComparable<T>

We illustrate generic interfaces with IComparable

/user/normark/oop-csharp-1/sources/c-sharp/interfaces/reproductions/IComparable-non-generic.csA reproduction of the non-generic interface IComparable.


/user/normark/oop-csharp-1/sources/c-sharp/interfaces/reproductions/IComparable.csA reproduction of the generic interface IComparable<T>.


/user/normark/oop-csharp-1/sources/c-sharp/generics/comparable-die/1/die-random.csA class Die that implements IComparable.


/user/normark/oop-csharp-1/sources/c-sharp/generics/comparable-die/2/die-random.csA 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