471,350 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Optional parameters in a procedure.

UJ
How do you make parameters optional in a procedure. I know I can have
multiple definitions but it would be nice if there was a way I could have
the single declaration. I thought there was a way to do that.

TIA - Jeff.
Dec 14 '05 #1
3 1210
overloading or sending null.

I do this alot

public void DoSomething(string a)
{
DoSomething(a, null);
}

public void DoSomething(string a, string b)
{
if(b == null)
// do something
else
// do something else
}

"UJ" <fr**@nowhere.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
How do you make parameters optional in a procedure. I know I can have
multiple definitions but it would be nice if there was a way I could have
the single declaration. I thought there was a way to do that.

TIA - Jeff.

Dec 14 '05 #2
No, not in C#. I believe that there is in VB.NET, though.

In C# you have to write overloads in order to get this effect.

Dec 14 '05 #3
UJ
OK. Thanks.

"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
No, not in C#. I believe that there is in VB.NET, though.

In C# you have to write overloads in order to get this effect.

Dec 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by yuliad | last post: by
1 post views Thread by ganesh wayachal via SQLMonster.com | last post: by
2 posts views Thread by et | last post: by
4 posts views Thread by Mark Baldwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.