-
Feb 2nd, 2018, 03:21 AM
#1
Thread Starter
Addicted Member
[RESOLVED] C# Equivalent to CALL in VB
Hi,
I used to program in VB sometimes, now i'm using C# due to flexibility of the language.
I want to know the following.
In VB i could use "Call" to call a specific procedure to be perfomed.
Something like.
Code:
Call TestAction
Sub TestAction
'do something
End Sub
Is there something similar in C#?
-
Feb 2nd, 2018, 03:57 AM
#2
Re: C# Equivalent to CALL in VB
There is no equivalent in C# because there's no need for an equivalent. In VB6 and earlier, there were certain circumstances where you had to use the Call keyword to call method. In VB.NET, you never need to use Call. You can do so, and it can be handy in certain rare situations, but it is never required. It is even less required in C#. If you want to call a method in C#, you just go ahead and call it using its name, no keyword(s) required.
Note that C# does require parentheses to be used when calling a method, which VB.NET does not unless arguments are provided.
-
Feb 2nd, 2018, 04:03 AM
#3
Re: C# Equivalent to CALL in VB
Call is not needed you just call the any method by its name like this
Code:
TestAction();
private void TestAction()
{
//Do Something
}
if it has an argument then you call it like this
Code:
TestAction("arg");
private void TestAction(string arg)
{
//Do Something
}
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Feb 2nd, 2018, 04:54 AM
#4
Thread Starter
Addicted Member
Re: C# Equivalent to CALL in VB
That solved the problem. I tried this before, but clearly not in the correct way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|