What is Generics in C# Programming Language?

Generics allow us to create type safe collections with no boxing and un-boxing overhead. It is a concept that allows us to achieve parametric polymorphism.

C# is a strongly typed language, i.e., objects in C# should have a type to holding any value. This enforces language interoperability and security but restricts the programmer to specify the type of an object at the time of writing the program as the type of an object in C# cannot be determined at runtime.

Generics are a new concept that has been introduced with C# 2.0. It is one of the most powerful and anticipated feature of the C# 2.0 language. The basic idea behind generics is to develop universal classes and methods that can accept a type as a parameter to promote reusability, efficiency and maintainability of code.