Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Overloading Question
Message
From
15/08/2007 15:12:50
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01248156
Message ID:
01248338
Views:
25
Why not just create an object that can contain your parameters or default value and pass that in? It would probably be cleaner and less work than a bunch of spagetti overloads. Since the parameters he mentions are all optional it would be hard to get them in any order that allowed for reasonable overloading.

Tim

>>I have a procedure that takes 6 params. All are optional. That means a large number of overloads.
>>
>>Can I somehow create optional params, or is there some way to check for optional params?
>>
>>Thanks
>
>I read the other replies.
>If you are using C# 2.0 you could use nullable types as parameters.
>Overloads are not really that bad if you structure it so that the overload that takes n-1 parameters call the method that takes n parameters and the method that takes n-2 parameters calles the method that takes n-1 parameters and so on.
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform