我想知道使用Call Keyword调用过程和在VB.NET中没有调用的优缺点?
Private Sub ProOne()
' Code Are Here
End Sub
Private Sub Calling()
ProOne() ' I would like to know pros and cons of this
Call ProOne() ' And I would like to know pros and cons of this
End Sub
Run Code Online (Sandbox Code Playgroud)
在此先感谢所有人.
我发现的一个有趣的用途(R#建议),就是当你需要创建一个实例来调用单个方法然后将其标记为垃圾收集时.
不知道我是否保留它.
例如
Call (new MyType()).MySub()
Run Code Online (Sandbox Code Playgroud)
相当于
dim anInstance = new MyType
anInstance.MySub
Run Code Online (Sandbox Code Playgroud)