VB.NET中调用过程的优缺点是什么? [英] What is pros and cons of calling procedures in VB.NET?

查看:139
本文介绍了VB.NET中调用过程的优缺点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在VB.NET中使用调用关键字"和不使用调用关键字"的调用过程的优缺点吗?

I would like to know the pros and cons of calling procedures with Call Keyword and without Call in 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

先谢谢大家.

推荐答案

来自此处:

您通常使用Call语句来调用不会 返回一个值.如果该过程返回一个值,则调用语句 丢弃它.

You normally use the Call statement to call a procedure that does not return a value. If the procedure returns a value, the Call statement discards it.

在调用以下内容时,您无需使用Call语句 程序.但是,它可以提高代码的可读性.

You are not required to use the Call statement when calling a procedure. However, it improves the readability of your code.

因此,从本质上讲,ProOne()和Call ProOne()在语义上是等效的.

So, in essence, ProOne() and Call ProOne() are semantically equivalent.

这篇关于VB.NET中调用过程的优缺点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆