Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to re-factor
Message
 
 
À
14/02/2013 09:04:33
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01565967
Message ID:
01566000
Vues:
55
>>It actually also needed closeSalespoint and closeOperator. I sent both as out parameters but I was thinking I may create the above as a class instead with these properties. Do you think it will be a better solution or 4 out parameters is not bad?
>
>
>Dunno - there are several ways
>
>Viv's personal limit is about 5
>Another option mentioned is to have the method return a Tuple - only inconvenience of a tuple is that the properties do not have meaningful names
>
>Another option suggested is to create a class. I would opt for a private nested class in that case

Can you show how the private nested class idea looks like, please?

This is what I currently have (last night did a few re-factoring operations). Thought today to keep re-factoring, but got some other work to do (in VFP).
private void ParseDetails(String cDetails, String currentOperator,
    String currentSalespoint, out String closeOperator, out String closeSalespoint, out DateTime startTime, out DateTime endTime)
{         
            closeOperator = cDetails.ParseStringFromSqml("CLOSE_OP");
            if (String.IsNullOrWhiteSpace(closeOperator))
                closeOperator = currentOperator;
            closeSalespoint = cDetails.ParseStringFromSqml("CLOSE_SP");
            if (String.IsNullOrWhiteSpace(closeSalespoint))
                closeSalespoint = currentSalespoint;

            startTime = cDetails.ParseDateTimeFromSqml("START_TIME");
            endTime = cDetails.ParseDateTimeFromSqml("END_TIME");
}
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform