0

I am developing an app for WP7. I pull some data out of a Sterling Database and put in into my own objects. These objects I am deriving a date attribute and setting that - it has a time already (that has been held on the object in the Sterling database).

I then want to sort these objects by date and time before presenting them. Currently Date and time are separate String fields but I can combine them into a DateTime attribute if I want.

Is there a recommended way of doing this. I have seen several options.. but not sure what is the best approach.

Any advice appreciated here. - thanks

3
  • you can declare DateTime property in derived object which will have logic for combinig date and time from exist properties and then use sorting on it Commented Jul 7, 2011 at 6:13
  • thanks for this... what is the best way to sort it? Commented Jul 7, 2011 at 9:59
  • you can sort using LINQ OrderBy, also you get all benefits described in first answer by Jesus Ramos Commented Jul 8, 2011 at 2:35

1 Answer 1

2

If you combine into a DateTime it makes your code a lot smaller. The reason for this is that DateTime supports comaprison operators such as <, >, ==, etc. That way you can just say (time1 < time2) or whatever your comparison function does.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.