Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overloading Question
Message
De
15/08/2007 15:12:50
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01248156
Message ID:
01248338
Vues:
26
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform