Click here to Skip to main content
15,883,971 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
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

I

excepted results is ....
1001=   11/2/12
1002=    18/2/12
1003=  17/3/12
1004= 14/6/12
1005= 2/7/12
Posted
Updated 9-Jul-12 0:42am
v2
Comments
DaveAuld 9-Jul-12 6:47am    
And the question is?
[no name] 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.
Sergey Alexandrovich Kryukov 9-Jul-12 15:45pm    
To start with: never use ArrayList for new development, use System.Collections.Generic.List<>.
--SA

How about this, wroks for me


XML
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"))));
 
Share this answer
 
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
Surname
DateJoined
Area
State
Country

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!

C#
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!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900