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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.