D. More Complex Examples: Writing Our Own Generic Classes

  1. It is simple to write our own generic classes. In our class declaration, we specify a parameter type name in angle brackets, as shown on the facing page. It is customary to use very short names for these, such as T and K, but I've gone with a longer one to remind you constantly of the type that name represents. In VB, the type parameter is declared using the Of operator. You then use that type name parameter to represent whatever type the user passes at instantiation time.

    chuck: come back

    Note

    Generics work only for parameters whose type is known at compile time. They do not automatically perform reflection to figure it out at runtime. They work very well, and are a big advantage, when dealing ...

Get Programming Microsoft® Composite UI Application Block and Smart Client Software Factory 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.