Get Statement

This statement begins a Get procedure block within a Property procedure definition.

Get

Prerequisites

Parameters

None

Remarks

The Get procedure block must always end with an End Get statement. When a procedure gets the containing Property, the Get procedure is executed. It is up to that procedure to retrieve or compute the property value and return it. The returned value of the Property is specified by assigning a value to a variable with the same name as the Property or by a Return statement.

Examples

Class cc
Private sizex2 As Integer = 44

Public ReadOnly Property size As Integer
Get
Return sizex2/2
End Get
End Property

End Class
:
Dim obj As New cc
Console.WriteLine(obj.size) ' Displays value 22

See Also

Statements |PropertyStatement| SetStatement