Strongly Typed Collections
You've seen that the .NET Framework Class Library offers a wide range of collection options. However, the collections in the Framework allow only generic elements of type Object. This is fine for most internal use, when you know what your code is doing. However, if you plan to expose your own collection objects, you'll want to strongly type them. Strong typing means to enforce the data type of elements within the collection. The Object data type allows anything to be added to your collection. For example, if you expose a collection of inventory objects and another developer adds a shipping notice to the collection, you will more than likely have a problem.
The good news is that the same interfaces and base classes used ...
Get Visual Basic® Programmer's Guide to the .NET Framework Class Library 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.