472,142 Members | 1,032 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

Sorting a list by DateTime stamp -- please help...

Hi,
I have a list object called "myList" with the first item a string and
the second a DateTime. Something like this:

"some text 1", 19/03/2008 12:56:36
"some text 2", 19/03/2008 10:56:36
"some text 3", 19/03/2008 11:56:36
"some text 4", 19/03/2008 13:56:36
I would like to sort "myList" (into a new list) by timestamp such
that the earliest time stamp is a tthe bottom. In this case it would
be:

"some text 2", 19/03/2008 10:56:36

Problem is though I don't know how to do this exactly! Would
appreciate any comments/suggestions/code-samples that you would liek
to share.

Thanking you,
Al.
Mar 19 '08 #1
1 2448

You would be very well served to read:
http://ludwig-stuyck.spaces.live.com/Blog/cns!E36D9BA98FC913B3!398.entry

the article on Generics.

It is in english.

...

Find the Sort section.

...

You can write the comparer "inline" (previous post on this thread) ... or
you can actually code up the the Comparer.

...

<al*****@altavista.comwrote in message
news:1e**********************************@e60g2000 hsh.googlegroups.com...
Hi,
I have a list object called "myList" with the first item a string and
the second a DateTime. Something like this:

"some text 1", 19/03/2008 12:56:36
"some text 2", 19/03/2008 10:56:36
"some text 3", 19/03/2008 11:56:36
"some text 4", 19/03/2008 13:56:36
I would like to sort "myList" (into a new list) by timestamp such
that the earliest time stamp is a tthe bottom. In this case it would
be:

"some text 2", 19/03/2008 10:56:36

Problem is though I don't know how to do this exactly! Would
appreciate any comments/suggestions/code-samples that you would liek
to share.

Thanking you,
Al.

Mar 19 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by pmud | last post: by
1 post views Thread by Abhijit Bhadra | last post: by
reply views Thread by Prasad More | last post: by
19 posts views Thread by Owen T. Soroke | last post: by
7 posts views Thread by apotheos | last post: by
4 posts views Thread by JB | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.