Hints and Tips Regarding Shared Members

To determine whether a field, property, or method would be better modeled as shared than as an instance member, you can look at a few criteria. We present a few of the most common ones later in this chapter.

If you have a class method or property that does not use or refer to any instance members, it is a good candidate for becoming a shared method or property.

If a field value is the same value in all objects, then it is almost certain that it would be better to be a shared field.

Sometimes, you will find out that a class, especially if imported from an older version of Visual Basic, would have a lot of methods and properties that are really shared, but they were not declared as such because the language ...

Get Visual Basic® .NET by Example 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.