Summary

This chapter took a look at the classes and language elements that target sets. You started with a look at arrays and the support for arrays within Visual Basic. The chapter then looked at collection classes. By default, these classes operate on the type Object, and it is this capability to handle any or all objects within their implementation that makes these classes both powerful and limited.

Following a quick review of the iterative language structures normally associated with these classes, the chapter moved on to looking at generics. Generics enable you to create class, structure, interface, and method templates. These templates gain specific types based on how they are declared or called at runtime. Generics provide you with another code reuse mechanism, along with procedural and object-oriented concepts.

Generics also enable you to change code that uses parameters or variables of type Object (or other general types) to use specific data types. This often leads to much better performance and increases the readability of your code.

Next you'll move into working with XML from Visual Basic. XML processing and generation are one of Visual Basic's strengths. As you'll see, while you may have an XML file with only a single entry, by its nature XML lends itself to creating collections of objects.

Get Professional Visual Basic 2012 and .NET 4.5 Programming 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.