CHAPTER 11 ■ GENERICS 297
programming. In traditional cases, polymorphism is explained within the context of virtual methods
known as dynamic polymorphism. You cannot implement static polymorphism with C# generics.
However, you can require that the type arguments given when forming a closed type support a spe-
cific contract by using a mechanism called constraints, which I cover in the following section.
Constraints
So far, the majority of generics examples that I’ve shown involve some sort of collection-style class
that holds a bunch of objects or values of a specific type. But many times, you’ll need to create
generic types that not only contain instances of various types but also use those objects directly by
calling methods or accessing properties ...