Chapter 7. Generic Constraints
Generic constraints represent a key component of the .NET generics implementation, allowing you to constrain your type parameters to specific interfaces. Knowing the strengths and limitations that are associated with using constraints is vital to broadening your understanding of what can ultimately be achieved with generic types. This chapter looks at all the different mechanisms that are available to you when deciding how, when, and what types of constraints you want to apply to your type parameters. It also looks at each of the constraint types and discusses some of the ramifications associated with combining constraints. The chapter also considers some of the broader implications that accompany the application of constraints.
Get Professional .NET 2.0 Generics 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.