Generics: Using generic methods

Using generic methods

T first<T>(List<T> ts) { 
   // Do some initial work or error checking, then... 
   T tmp = ts[0]; 
   // Do some additional checking or processing... 
   return tmp; 
}

A newer syntax, called generic methods, allows type arguments on methods and functions.

Related concepts

Generics: Using generic methods — Structure map

Clickable & Draggable!

Generics: Using generic methods — Related pages: