Module ExtendsModule <Extension()> Public Sub exMethod(ByVal X As Class1) '略 End Sub End Module Dim x As New Class1 'エディタ非表示 exMethod(x) 'エディタ非表示 ExtendsModule.exMethod(x) 'エディタ表示 x.exMethod()
Module ExtendsModule <Extension()> Public Function PreIncrement(ByRef a As Integer) As Integer a += 1 Return a End Function <Extension()> Public Function AftIncrement(ByRef a As Integer) As Integer Dim b As Integer = a a += 1 Return b End Function End Module (1) Dim i As Integer = 1 Dim j As Integer j = i.PreIncrement 'i = 2, j = 2 (2) Dim i As Integer = 1 Dim j As Integer j = i.AftIncrement 'i = 2, j = 1