Is there a way to make a parameter optional in a web server? I've got two
routines that will work almost exactly the same except that one needs an
extra parameter to do a check. I supposed I could something like:
public int WithOneParm ( int parm1 )
{
}
public int WithTwoParm (int parm1, int parm2 )
{
// Do what is needed for this.
WithOneParm ( parm1 );
}
but I'd love to be able to have just the one routine.
TIA - Jeff.
Martin Kulov - 28 Dec 2005 18:10 GMT
> Is there a way to make a parameter optional in a web server?
Hi Jeff,
AFAIK, you can not create optional parameters in web services.
That's a design restriction, at least for now.
However you van overload the method and create versions of the method with
one and two parameters.
Happy holidays,

Signature
Martin Kulov
http://www.codeattest.com/blogs/martin
MCAD Charter Member
MCSD.NET Early Achiever
MCSD
BobG - 30 Dec 2005 20:21 GMT
You could do this with a dataset that has 2 tables. Each table has one column
and one row. Place the required parameter in one table and the optional
parameter in the other.
Note with this approach the datatypes of the parameters can be different and
it's not a problem.
Good luck with your work!
> Is there a way to make a parameter optional in a web server? I've got two
> routines that will work almost exactly the same except that one needs an
[quoted text clipped - 13 lines]
>
> TIA - Jeff.