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

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

Vb.Net To C# (Translate)

HI

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

0
AWestEng
Asked:
AWestEng
  • 5
  • 2
1 Solution
 
SStoryCommented:
on this line, you do not pass arguments to a method that has a signature for arguments
 guardFooIsTrue = FooIsTrue;
0
 
AWestEngAuthor Commented:
how should the solution should look like?
0
 
AWestEngAuthor Commented:
That is the error yes, I know..
So how do I fix it?
0
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?
0
 
jorgesv13Commented:
Try:
guardFooIsTrue  = New GuardHandler (AddressOf FooIsTrue)
0
 
AWestEngAuthor Commented:
jorgesv13 almost,,
 It should be

guardFooIsTrue = AddressOf FooIsTrue
0
 
SStoryCommented:
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.
0
 
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
 
 
0

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