what is cDetails in the parameter list? This parameter seems misnamed. What is tcDetails? Also misnamed. In .Net, variable, properties should not use Hungarian Notation (this is by convention).
ParseDetails doesn't tell me much about the class. What details? The class name should be more specific about what type of details.
I HIGHLY recommend this book
http://search.barnesandnoble.com/Framework-Design-Guidelines/Krzysztof-Cwalina/e/9780321545619Even if you aren't creating frameworks, it provides good insight on how to build classes in your application.
Also, here the coding guidelines we use.
http://csharpguidelines.codeplex.com/Additionally, learn how FxCop works (or Visual Studio Code Analysis if you're using a VS sku higher than Professional) to check your code. Static code analysis is an important thing to keep your code more maintainable and have fewer bugs.
As for parameter ordering, I don't think it matters. With named parameters, you can specifiy anything in any order anyway when you call it (although named parameters are not recommended).
>
>Here is what I have now:
>
>
>/// <summary>
> /// Class used to parse tcDetails into common properties (StartTime, EndTime, closeOperator, closeSalesPoint)
> /// </summary>
> private class DrawerDetails
> {
> public DateTime StartTime { get; private set; }
> public DateTime EndTime { get; private set; }
> public String CloseOperator { get; private set; }
> public String CloseSalespoint { get; private set; }
>
> public void ParseDetails(String cDetails, String currentOperator, String currentSalespoint)
> {
> 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");
> }
>
> }
>
>and one more question - when I pass this class as a parameter among other parameters - should this class parameter be first? Just want to follow the convention.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer