Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to re-factor
Message
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:
01565998
Vues:
36
>>I changed the top part (up to OK to close drawer) into a separate method. The question now is - can I re-use this piece somehow in two places?
>>
>>
>>String currentOperator, currentSalespoint, closeOperator, closeSalespoint, cDetails;
>>                        currentOperator = GetParameterValue(parameters, "tcOperator");
>>                        currentSalespoint = GetParameterValue(parameters, "tcSalespoint");
>>                        cDetails = GetParameterValue(parameters, "tcDetails");
>>                        closeOperator = cDetails.ParseStringFromSqml("CLOSE_OP");
>>                        if (String.IsNullOrWhiteSpace(closeOperator))
>>                            closeOperator = currentOperator;
>>                        closeSalespoint = cDetails.ParseStringFromSqml("CLOSE_SP");
>>                        if (String.IsNullOrWhiteSpace(closeSalespoint))
>>                            closeSalespoint = currentSalespoint;
>>                        DateTime startTime, endTime;
>>                        startTime = cDetails.ParseDateTimeFromSqml("START_TIME");
>>                        endTime = cDetails.ParseDateTimeFromSqml("END_TIME");
>>
>>
>>?
>>
>>I guess I can pass back all parameters by reference, but is it a good solution?
>>
>>
>
>No. I would create a small class with those variables as properties and return that instead.

Thanks, that's what I was also thinking - I may try go this route then.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform