Posted in .Net Basics

Generics in C# .Net

When we look at the term “Generic”, unrelated to our programming world, it simply means that it is not tied to some predefined type and in programming terminology:

Generics allow you to define type-safe classes without compromising type safety, performance, or productivity.

In our programming world, “Generic” provides the functionality to handle any Type in generic and Type safe manner. That means we can have a single array class that we can use to store a list of Employee or a list of Items, and at the time of using them, we’ll be able access them in the collection directly as a list of Employee or Items, and not as Object. That means we don’t need to do boxing/unboxing or casting, which in turn gives us a performance boost.

Continue reading “Generics in C# .Net”