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

前端 未结 3 1862
粉色の甜心
粉色の甜心 2020-12-01 13:49

I just installed Visual Studio 2010 Service pack (proposed on Windows Update), and I can see a new feature on the \"intellisense\" that means when I write a Function

3条回答
  •  萌比男神i
    2020-12-01 14:18

    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
    

提交回复
热议问题