Why is it not necessary to indicate ByVal/ByRef anymore?

It seems that this post covers your question:

http://msmvps.com/blogs/carlosq/archive/2011/03/15/vs-2010-sp1-changing-quot-byval-quot-vb-net-code-editor-experience.aspx

So no, there is no way to get the old behaviour. From now on ByVal is the default (what it was before) and it won’t get added automatically to the method parameters.

In my opinion this is a good decision since it’s making VB.NET a bit more consistent with C# and avoids unnecessary “noises”(it’s already verbose enough).

Old behaviour:

Private Sub test(ByVal test As String)
End Sub

New behaviour

Private Sub test(test As String)
End Sub

Leave a Comment