Jump to content

Introduction to .NET Framework 3.0/Generics

From Wikibooks, open books for an open world

Microsoft has introduced new generical features in its .NET 3.0. Until now, it was mandatory that the whole list should be declared as a single data type. However, in .NET 3.0, it is possible to have multiple declarations of the same list with multiple data type and the datatype of the data contained in it changes.

Example

[edit | edit source]
List<string> customerList = new List<string>(); 
customerList.Add('Ravi');
customerList.Add('Bala');
List<int> customerList = new List<int>();
customerList.Add(1);