Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is pros and cons of calling procedures in 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

Thanks in advance all.

like image 627
RedsDevils Avatar asked Dec 04 '09 16:12

RedsDevils


2 Answers

There are no pros, and there are no cons.

The Call keyword is a legacy keyword from older VB dialects.

In VB.net it has no meaning, and is syntatic sugar.

like image 57
Binary Worrier Avatar answered Oct 21 '22 06:10

Binary Worrier


From here:

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.

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

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

like image 36
Michael Todd Avatar answered Oct 21 '22 06:10

Michael Todd