This chapter looked at many of the basic building blocks of Visual Basic that are used throughout project development. Understanding not only the basic components, but also how they work will help you to write more stable and better performing software. Note the following highlights of this chapter:
Beware of array sizes; all arrays start at 0 and are defined not by size but by the highest index.
Remember to use the StringBuilder class for string manipulation.
Pay attention to variable scope, and rely on it for cleaning up variables you no longer need.
Use Option Strict; it’s not just about style, it’s about performance.
Try to avoid legacy methods for conversions.
Attempt to leverage the TryParse and TryCast methods.
Understand variable scope and when variables will go out of scope.
Take advantage of the new collection classes, especially generics.
While this chapter covered many other items, including the new Decimal type and how boxing works, these highlight some of the more important items. Whether you are creating a new library of methods or a new user interface, these items consistently turn up in some form. You have seen that while .NET provides a tremendous amount of power, that power comes at a sometimes significant performance cost.