■
Source Code
The GenericMethod project is located under the Chapter 10 directory.
Creating Generic Structures and Classes
Now that you understand how to define and invoke generic methods, let’s turn our attention to the
construction of a generic structure (the process of building a generic class is identical) within a new
Console Application project named GenericPoint. Assume you have built a generic Point structure
that supports a single type parameter representing the underlying storage for the (x, y) coordinates.
The caller would then be able to create Point types as follows:
Do'stlaringiz bilan baham: |