Changes to Properties

Properties have been modified in Visual Basic .NET to use a unified approach to ensure that modifiers to property methods are applied uniformly to the getter and setter methods. Whereas VB6 implemented the property getter and setter as two separate property methods, Visual Basic .NET groups properties into a single block with the getter and setter as nested elements.

Unified Property Statement in Visual Basic .NET

The basic, unified property statement in Visual Basic .NET has an outer property block and an inner Get and Set block.

Private Property Dummy() As Integer
  Get
  End Get
  Set(ByVal Value As Integer)

  End Set
End Property

The As clause in the property header defines the property's data type. Dummy is an Integer property. ...

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.