• home
  • Email: trainings@synapseindia.careers

Blogs

back

An Introduction to C# Generics

Jun 03, 2015

Generics are the most powerful feature of C# 2.0. Generics allow you to define type-safe data structures, without committing to actual data types. This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code. In concept, generics are similar to C++ templates, but are drastically different in implementation and capabilities. This article discusses the problem space generics address, how they are implemented, the benefits of the programming model, and unique innovations, such as constrains, generic methods and delegates, and generic inheritance. You will also see how generics are utilized in other areas of the .NET Framework such as reflection, arrays, collections, serialization, and remoting, and how to improve on the basic offering. Generic classes and methods combine re-usability, type safety and efficiency in a way that their non-generic counterparts cannot. Generics are most frequently used with collections and the methods that operate on them.

SynapseIndia (CEO: Shamit Khemka)

One thought on “An Introduction to C# Generics

  1. Must note point that generics are similar to C++ templates, but are drastically different in implementation and capabilities.

Comments are closed.