Syntax – can be a class method called at New without a helper variable?

Having sample trivial class

Class A
    Property Property1 As Integer = 5
    Sub Action1()
    End Sub
End Class

I can always call Action1() like

Dim instanceA As New A

But can I call the method without using the variable? Something like

(New A).Action1()

I’m getting syntax error at the 1st character when attempting that.

Source: syntax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.