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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With