Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 9-Jul-12 0:41am
Edited 9-Jul-12 0:42am
v2
Comments
DaveAuld at 9-Jul-12 6:47am
   
And the question is?
Sandeep Mewara at 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 at 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 at 9-Jul-12 15:45pm
   
To start with: never use ArrayList for new development, use System.Collections.Generic.List<>.
--SA
Rate this: bad
good
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
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!
 
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!
  Permalink  
Rate this: bad
good
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"))));
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 598
1 OriginalGriff 235
2 George Jonsson 230
3 CPallini 210
4 PIEBALDconsult 150
0 OriginalGriff 5,835
1 Sergey Alexandrovich Kryukov 5,263
2 CPallini 4,750
3 George Jonsson 3,227
4 Gihan Liyanage 2,487


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2014
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