| Team-Fly || |
| || Visual Basic .NET Unleashed |
By Paul Kimmel
| Table of Contents |
| Chapter 11. Shared Members |
Shared members allow you to perform operations, and shared fields and properties allow you to maintain state information when only one instance of the information is needed. The general class and object relationship supports maintaining individuated state between objects. Most of the time you need an object, and some of the time it's simply more convenient not to have to create an instance of an object. A utility class such as the Math class is a perfect example of a stateless class that uses shared members.
In addition to learning about shared fields, properties, and methods , Chapter 11 introduced shared events and overloaded shared members. You probably won't need these idioms on a routine basis, but if and when you do need them, they will be sorely missed.
Some techniques, like linking instances by a shared field, allow you to write more expressive code. If what we can think about is limited by our language, the more expressive a language is, the more flexibility we have in expression. Visual Basic .NET is a much more expressive language than its predecessors, allowing us to implement more advanced idioms.