Any time a class declaration contains a type parameter list, it is, from
that point on, a generic type. Likewise, any nested class declaration, whether it??™s generic or
not, that is declared within the scope of a generic type is a generic type itself. That??™s because
the enclosing type??™s fully qualified name requires a type argument in order to completely
specify the nested type.
Generic types are overloaded based upon the number of arguments in their type argument
lists. The following example illustrates this:
Public Class Container
End Class
Public Class Container(Of T)
End Class
Public Class Container(Of T, R)
End Class
Each of the previous declarations is valid within the same namespace. You can declare as
many generic types based on the Container identifier as you want, as long as each one has a
different count of type parameters. You cannot declare another type named Container(Of X,
Y), even though the identifiers used in the type parameters list are different. The name overloading
rules for generic declarations are based on the count of type parameters rather than
the names given to their placeholders.
When you declare a generic type, you??™re declaring what is called an open type. It??™s called
an open type because its fully specified type is not yet known.
Pages:
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394