Vb.Net To C# (Translate)


Need some help to translate some C# code to vb.net

If I use "http://www.developerfusion.com/tools/convert/csharp-to-vb/ "then I will get

Protected MustOverride Function FooIsTrue(ByVal args As Object()) As Boolean
Public Delegate Function GuardHandler(ByVal args As Object()) As Boolean
Private guardFooIsTrue As GuardHandler

Private Sub InitializeGuards()
    guardFooIsTrue = FooIsTrue
End Sub

But this code does not work, It will give an error:
Argument not specified for parameter 'args' of 'Protected MustOverride Function FooIsTrue(ByRef args() As Object) As Boolean'.
protected abstract bool FooIsTrue(object[] args);
public delegate bool GuardHandler(object[] args);
private GuardHandler guardFooIsTrue;
private void InitializeGuards()
  guardFooIsTrue = FooIsTrue;

Open in new window

Who is Participating?
jorgesv13Connect With a Mentor Commented:
guardFooIsTrue  = New GuardHandler (AddressOf FooIsTrue)
on this line, you do not pass arguments to a method that has a signature for arguments
 guardFooIsTrue = FooIsTrue;
AWestEngAuthor Commented:
how should the solution should look like?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

AWestEngAuthor Commented:
That is the error yes, I know..
So how do I fix it?
AWestEngAuthor Commented:
The C# code woks just fine, I need help to get this code to work in vb.net ?
so anyonw knows how to do that?
AWestEngAuthor Commented:
jorgesv13 almost,,
 It should be

guardFooIsTrue = AddressOf FooIsTrue
AWestEng, if you knew that was the error, why didn't you say so.  The solution to a sub or function that expects arguments in the call is to supply the arguments.

I think I gave you enough of an answer to have deserved some partial credit.
AWestEngAuthor Commented:
The error message was in the original post, in that one it "already says" what you posted.
I asked for tanslation of the C# code to VB.Net code not pointing out the error.
I know you have good skils but I was in a hurry to solve the problem.. so I'm  sorry if I didn't wait for you..  my bad.
I will be more easy on the mouse button next time.
Thx for helping.
sorry m8
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.