Optional parameters in a procedure.

  • Thread starter Thread starter UJ
  • Start date Start date
U

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.
 
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
}
 
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.
 
Back
Top