Click here to Skip to main content
13,259,976 members (51,915 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i have

one list<>=table scheme

it show like this
list[0]={''raja,'muthaiah,'male','11/2/12','chennai','tamil nadu','india'}                        11/2/12
list[1]={''vijay,'kumar,'male','2/7/12','chennai','tamil nadu','india'}                              2/7/12
list[2]={''kumar,'vel,'male','17/3/12','chennai','tamil nadu','india'}                              17/3/12
list[3]={''pradeep,'kumar,'male','14/6/12','chennai','tamil nadu','india'}                      14/6/12
list[4]={''gowtham,'manen,'male','18/2/12','chennai','tamil nadu','india'}                    18/2/12

above the data will be post one place ...that have last auto generate id is=1000

So, now i want to generate id no to FIFO method to sort on date basics type


excepted results is ....
1001=   11/2/12
1002=    18/2/12
1003=  17/3/12
1004= 14/6/12
1005= 2/7/12
Posted 9-Jul-12 1:41am
Updated 9-Jul-12 1:42am
DaveAuld 9-Jul-12 6:47am
And the question is?
rajamuthaiahv 9-Jul-12 7:10am
I want to sort Array list with ascending order type Date ,,, But array list index has one table record.
Sandeep Mewara 9-Jul-12 6:52am
Not clear. This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
Matt T Heffron 9-Jul-12 13:38pm
To figure out what you are doing wrong we need to see what you are doing now. Use the "Improve question" and include the code that you think should be working.
To start with: never use ArrayList for new development, use System.Collections.Generic.List<>.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

My solution is more of advice than a solution...
Sergey is correct, use System.Collections.Generic.List<> and create yourself a class of Person or client as it looks like.

So in your class have

First Name

or what ever the items are.

Now if you populate a List of Person or Client Class, you can iterate through them with LINQ, and use that to sort it into Date Ascending order!

List<clients> myClientList = new List<clients>(){};</clients></clients>

myClientList would be populated with the results, and then you could sort them with LINQ.

Understanding LINQ (C#)[^]

Does that give you a bit of a helping hand to start with? Codeproject has a lot of really useful articles that will be able to assist you!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

How about this, wroks for me

var list = new List<string[]>();
           list.Add(new[] {"raja", "muthaiah", "male", "11/2/12", "chennai", "tamil nadu", "india"});
           list.Add(new[] {"vijay", "kumar", "male", "2/7/12", "chennai", "tamil nadu", "india"});
           list.Add(new[] {"kumar", "vel", "male", "17/3/12", "chennai", "tamil nadu", "india"});
           list.Add(new[] {"pradeep", "kumar", "male", "14/6/12", "chennai", "tamil nadu", "india"});
           list.Add(new[] {"gowtham", "manen", "male", "18/2/12", "chennai", "tamil nadu", "india"});
         list=  new List<string[]>(list.OrderBy(n=>DateTime.Parse(n[3],CultureInfo.CreateSpecificCulture("en-GB"))));

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171114.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100