Overloading Type Parameters

You can overload generic definitions providing different signatures for the type parameter, similar to what happens in methods overloads. The following code provides an example:

image

It is worth mentioning that providing a nongeneric version of your class is not necessary. In this way you can provide different implementations for your generic types. Now consider the following overloading attempt:

image

This code is not compiled because although in the second definition some constraints are defined, the type implementation is considered ...

Get Visual Basic® 2010 Unleashed 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.