Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'd rather overload.

 

Public Function myMethod () as string
Public Function myMethod (aParm as string) as string
Public Function myMethod (anObj as object) as string

.nerd
Posted

That is probably VB and I don't think you quite know what I mean. I guess the only way is to use method overloading, right?

 

I see someone already posted that. Ok, got my answer.

C#
  • Leaders
Posted
That is probably VB and I don't think you quite know what I mean.

It works in VB.NET, being a .NET related forum, I generally try to provide answers that work in .NET.

I guess the only way is to use method overloading, right?

Ummm... NO. Method overloading is probably a better approach to getting the functionality you require, but the Optional keyword is there just as I said above -- it is exactly what you asked for btw.

--tim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...