Chapter 6: Generics
In the previous chapter, we learned about OOP in C#. In this chapter, we will explore the concept of generics. Generics allow us to create classes, structures, interfaces, methods, and delegates in such a manner that they will work in a type-safe environment with different data types. Generics were added as a part of the C# 2.0 release. It promotes code reusability and extensibility and is one of the most powerful features of C#.
We will learn about the following concepts in this chapter:
- Generic classes and generic inheritance
- Generic interfaces and variant generic interfaces
- Generic structures
- Generic methods
- Type constraints
By the end of this chapter, you will have gained the skills necessary to write generic types, ...
Get Learn C# Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.