Properties in Visual Basic
A Property is similar to a Function. With a getter and a setter, it controls access to a value. This value is called a backing store. With Get it returns a value. With Set it stores a value.
Example
Class Example1 Private _count As Integer Public Property Number() As Integer Get Return _count End Get Set(ByVal value As Integer) _count = value End Set End Property End Class Module Module1 Sub Main() Dim obj As Example1 = New Example1() obj.Number = 1 Console.WriteLine(obj.Number) Console.ReadLine() End Sub End Module
Output
1