RickBeddoe
Programmer
Hello folks,
I am having a dilemma with the list.sort method.
The data I'm using is stored in the 'heading' member of the 'Contexts' objects (p1,p2). Here's my data:
3 months ending 9/30/2007
3 months ending 9/30/2008
9 months ending 9/30/2007
9 months ending 9/30/2008
Here is my sort code:
lst.Sort(delegate(Contexts p1, Contexts p2)
{
return p1.heading.CompareTo(p2.heading);
}
);
Using lst.Sort as you see above, yields the result you expect above. What I'd really like to do is a sort within a sort. I would like my data to look like this (note the years are descending within each month period):
3 months ending 9/30/2008
3 months ending 9/30/2007
9 months ending 9/30/2008
9 months ending 9/30/2007
I tried to put another anonymous method within the sort method, but that did not do what I wanted (it threw an exception).
Any help will be appreciated.
Cheers,
Rick
I am having a dilemma with the list.sort method.
The data I'm using is stored in the 'heading' member of the 'Contexts' objects (p1,p2). Here's my data:
3 months ending 9/30/2007
3 months ending 9/30/2008
9 months ending 9/30/2007
9 months ending 9/30/2008
Here is my sort code:
lst.Sort(delegate(Contexts p1, Contexts p2)
{
return p1.heading.CompareTo(p2.heading);
}
);
Using lst.Sort as you see above, yields the result you expect above. What I'd really like to do is a sort within a sort. I would like my data to look like this (note the years are descending within each month period):
3 months ending 9/30/2008
3 months ending 9/30/2007
9 months ending 9/30/2008
9 months ending 9/30/2007
I tried to put another anonymous method within the sort method, but that did not do what I wanted (it threw an exception).
Any help will be appreciated.
Cheers,
Rick