Lecture overview -- Keyboard shortcut: 'u'  Previous page: Generic Methods [Section] -- Keyboard shortcut: 'p'  Next page: Generic Delegates -- 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 18 : 21
Object-oriented Programming in C#
Generic Types and Methods
Generic Methods

A generic method is a template of a method that takes a number of type parameters

It is possible to have generic methods in both generic and non-generic types

/user/normark/oop-csharp-1/sources/c-sharp/generics/string/app-1.csThe generic method ReportCompare in the generic String programs. This program is explained


/user/normark/oop-csharp-1/sources/c-sharp/generics/string/app-3.csAn equivalent program without automatic inference of the actual type parameters. This program is explained


 

/user/normark/oop-csharp-1/sources/c-sharp/generics/sort/sort-appl.csA generic bubble sort program.


/user/normark/oop-csharp-1/sources/c-sharp/generics/sort/outputOutput from the generic bubble sort program.