Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do i create a link to a web page? Pin
Matt Gerrans9-Nov-05 15:59
Matt Gerrans9-Nov-05 15:59 
GeneralRe: How do i create a link to a web page? Pin
Luis Alonso Ramos9-Nov-05 19:28
Luis Alonso Ramos9-Nov-05 19:28 
QuestionCan a C# class be made aware as soon as its instance goes out of function scope? Pin
chervu9-Nov-05 9:32
chervu9-Nov-05 9:32 
AnswerRe: Can a C# class be made aware as soon as its instance goes out of function scope? Pin
Daniel Turini9-Nov-05 10:07
Daniel Turini9-Nov-05 10:07 
QuestionOverloading the assignment operator Pin
budidharma9-Nov-05 9:12
budidharma9-Nov-05 9:12 
AnswerRe: Overloading the assignment operator Pin
leppie9-Nov-05 10:14
leppie9-Nov-05 10:14 
QuestionSorting a ArrayList on multiple fields Pin
miah alom9-Nov-05 9:00
miah alom9-Nov-05 9:00 
AnswerRe: Sorting a ArrayList on multiple fields Pin
Leslie Sanford9-Nov-05 9:41
Leslie Sanford9-Nov-05 9:41 
alam_pune wrote:
I am looking for a way to sort an ArrayList on Multiple fields similar to the following.
eg. select * from table1 order by col1 desc, col2 asc, col3 desc.

I have implemented the IComparer for the different fields. I am not sure how to go forward from here. I am trying to achieve best performance.


Hmm, I think what you need to do is implement IComparer for each select statement. You'll need to implement an IComparer that sorts not just on one field but on all of them, or at least the ones in your select statement.

So to use your example, your IComparer would first compare the values in the first column between two items. If they aren't equal, you can stop the comparison and return the result. If they are equal, you move on to the next column and make a comparison there. Again, if they aren't equal, you can stop the comparisons and return the result. Else, you move on to the third column, and so on. The value of the result of each comparison will depend on the ordering you want, descending or ascending. I think this is what you're looking for. Hope this helps.
GeneralRe: Sorting a ArrayList on multiple fields Pin
miah alom9-Nov-05 11:07
miah alom9-Nov-05 11:07 
QuestionCustomizing PropertyGrid to show hyperlinks Pin
markjkruger9-Nov-05 8:10
markjkruger9-Nov-05 8:10 
QuestionGantt chart component Pin
ppp0019-Nov-05 6:58
ppp0019-Nov-05 6:58 
AnswerRe: Gantt chart component Pin
IdUnknown9-Nov-05 10:16
IdUnknown9-Nov-05 10:16 
AnswerRe: Gantt chart component Pin
Suelinda_W14-Nov-05 4:11
Suelinda_W14-Nov-05 4:11 
QuestionPausing program execution Pin
smurfy349-Nov-05 6:58
smurfy349-Nov-05 6:58 
AnswerRe: Pausing program execution Pin
Wjousts9-Nov-05 7:28
Wjousts9-Nov-05 7:28 
QuestionSocket programming Pin
Iftikar9-Nov-05 5:21
Iftikar9-Nov-05 5:21 
AnswerRe: Socket programming Pin
Judah Gabriel Himango9-Nov-05 5:25
sponsorJudah Gabriel Himango9-Nov-05 5:25 
QuestionNew Item on Properties Window Pin
Caio19859-Nov-05 5:20
Caio19859-Nov-05 5:20 
AnswerRe: New Item on Properties Window Pin
Jon Rista9-Nov-05 10:33
Jon Rista9-Nov-05 10:33 
Questiongetting the icon for a specific folder Pin
defaulk9-Nov-05 3:39
defaulk9-Nov-05 3:39 
Questionshowing a panel on a dialog Pin
NikoTanghe9-Nov-05 3:28
NikoTanghe9-Nov-05 3:28 
AnswerRe: showing a panel on a dialog Pin
Kurt _B9-Nov-05 6:49
Kurt _B9-Nov-05 6:49 
GeneralRe: showing a panel on a dialog Pin
NikoTanghe9-Nov-05 10:53
NikoTanghe9-Nov-05 10:53 
GeneralRe: showing a panel on a dialog Pin
Kurt _B9-Nov-05 12:10
Kurt _B9-Nov-05 12:10 
GeneralRe: showing a panel on a dialog Pin
NikoTanghe9-Nov-05 21:11
NikoTanghe9-Nov-05 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.