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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • almurph@altavista.com

    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.
  • sloan

    #2
    Re: Sorting a list by DateTime stamp -- please help...


    You would be very well served to read:
    http://ludwig-stuyck.spaces.l ive.com/Blog/cns!E36D9BA98FC 913B3!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.

    ...



    <almurph@altavi sta.comwrote in message
    news:1ee455e1-6f91-4eff-a8b0-17c3ce703e2a@e6 0g2000hsh.googl egroups.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.

    Comment

    Working...