开发者

C# Sorting objects multiple keys

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 he开发者_开发百科ld 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜