c# - Multi-level sorting on strings -


here same of raw data have:

sana paden,1098,64228,46285,2/15/2011 ardelle mahr,1242,85663,33218,3/25/2011 joel fountain,1335,10951,50866,5/2/2011 ashely vierra,1349,5379,87475,6/9/2011 amado loiacono,1406,62789,38490,7/17/2011 joycelyn dolezal,1653,14720,13638,8/24/2011 alyse braunstein,1657,69455,52871,10/1/2011 cheri ravenscroft,1734,55431,58460,11/8/2011 

i used filestream nested streamwriter determine first, how many lines in file, 2 create array of longs give me start of every line in file. code , out put follows:

using (filestream fs = new filestream(@"c:\sourcedatatoedit.csv", filemode.open, fileaccess.read)) {     fs.seek(offset, seekorigin.begin);     streamreader sr = new streamreader(fs);     {         while (!sr.endofstream && fs.canread)         {             streamsample = sr.readline();             numoflines++;          }// end while block     }//end stream sr block      long[] dataarray = new long[numoflines];     fs.seek(offset, seekorigin.begin);     streamreader dr = new streamreader(fs);     {         numoflines = 0;         streamsample = "";          while (!dr.endofstream && fs.canread)         {             streamsample = dr.readline();             //pointers.add(numoflines.tostring());             dataarray[numoflines] = offset;             offset += streamsample.length - 1;             numoflines++;         }// end while 

one string contains name, id, loan amount, payment amount , payment date. have method in place return remaining amount subtracting payment amount loan amount , dividing 100 dollar , cents value.

after doing want order information date, name, , lastly negative amounts first. understand create loan class create list of loan objects , run linq objects query against set obtain im trying without use of linq....any suggestions?

depending on context code, can gain many benefits introducing custom class / business object. provide separation of concerns in code, , move more manageable , testable code. can implement icomparable interface can invoke custom sort on collection of type list.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -