Understanding Generics and Nullable Data Types


Generics can arguably be viewed as the major enhancement provided by VB 2005. As you have seen, a generic item allows you to specify “placeholders” (i.e., type parameters) that are specified at the time of creation (or invocation, in the case of generic methods). Essentially, generics provide a solution to the boxing and type-safety issues that plagued .NET 1.1 development.

While you will most often simply make use of the generic types provided in the .NET base class libraries, you are also able to create your own generic types. When you do so, you have the option of specifying any number of constraints to increase the level of type safety and ensure that you are performing operations on types of a “known quantity.”


Type Parameter Module Program Public Function Type Safety Public Class 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Andrew Troelsen 2006

Personalised recommendations