[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 473
  • Last Modified:

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

  • 5
  • 2
1 Solution
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?
AWestEngAuthor Commented:
That is the error yes, I know..
So how do I fix it?
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

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?
guardFooIsTrue  = New GuardHandler (AddressOf FooIsTrue)
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now