What are Generics?
Interview question and answer by: Poster
| Posted on: 9/12/2010 | Category: C# Interview questions
| Views: 2888 | | Points: 40
Generics means parametrized types. A class, structure, interface, delegates that operates on a parametrized type is called generics.
The ability to create type-safe code in which type-mismatch errors are caught at compile time rather than run time is the key advantage of the Generics. So using generics on the class, interface, methods or delegates avoids run time errors as it is caught at the compile time itself.
In order to use Generics, we need to work with System.Collections.Generic namespace.
IList<>, IEnumerable, IEnuerator<>, IComparer<>, ICollection<> and IDictionary are some of the frequently used generics objects.
| Alert Moderator
Found interesting? Add this to: