Adding Field and Property Members

A field is a data member of a class. Fields can be ValueType members, like Integers or Dates, or can be aggregate types, like structures, enumerations, or classes. A property is a special member construct that is used like a field, but acts like a method. Properties are special kinds of methods that generally are used to provide constrained access to fields.

As a general rule, fields are private elements of a class. If access is provided to a field, the access is provided using a property. For this reason, fields are generally private and properties are generally public. However, sometimes fields aren't exposed through properties or at all. Properties don't always represent a field, either. Sometimes properties ...

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