ME keyword

The Me keyword is the similar to the this keyword of C#. The Me keyword is used to get the reference of the current type.

The below example defines the ME keyword.

Module Module1

Class Rectangle

Public Width As Integer

Public Height As Integer

Public Sub New(ByVal Width As Integer, ByVal Height As Integer)

Me.Width = Width

Me.Height = Height

End Sub

End Class

Sub Main(ByVal args As String())

Dim r As New Rectangle(2, 3)

Console.WriteLine(r.Width)

Console.WriteLine(r.Height)

End Sub

End Module

OUTPUT

me1.gif


If we remove the ME keyword from the above program then this will display the following output.

OUTPUT

me2.gif