Defining Shared Properties

As a general rule, fields are declared as private members. You can declare shared fields as private members too and use shared properties to provide access to shared fields.

A property is a special kind of method that is used like data but calls getter and setter methods, which for all intents and purposes are methods. The relationship is that fields are private and properties provide a public means of accessing data through implicit calls to property methods with the ease of using data. Thus you would use shared fields and properties in pairs just as you would use instance fields and properties in pairs. To define shared properties, you will need to place the Shared keyword between the access specifier and the keyword ...

Get Visual Basic® .NET Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.