Click here to Skip to main content
15,908,842 members
Home / Discussions / C#
   

C#

 
GeneralDynamic string conversion in c# Pin
Justin Hummel13-May-06 22:05
Justin Hummel13-May-06 22:05 
GeneralRe: Dynamic string conversion in c# Pin
Robert Rohde13-May-06 22:16
Robert Rohde13-May-06 22:16 
GeneralRe: Dynamic string conversion in c# Pin
Justin Hummel13-May-06 22:23
Justin Hummel13-May-06 22:23 
Question16-bit image Pin
IMClimatology13-May-06 18:53
IMClimatology13-May-06 18:53 
QuestionHow to display drivers in combobox? Pin
cshong13-May-06 18:53
cshong13-May-06 18:53 
QuestionUSB PNP Pin
rudy.net13-May-06 14:24
rudy.net13-May-06 14:24 
AnswerRe: USB PNP Pin
rudy.net13-May-06 16:10
rudy.net13-May-06 16:10 
QuestionIComparable interface *2 Pin
eggie513-May-06 14:23
eggie513-May-06 14:23 
So I have this class, AdminPaper and it implements, IComparable to sort an array of AdminPapers by a property of AdminPaper.

The implementation looks like this:

public int CompareTo(object obj)
{
    AdminPaper paper = (AdminPaper)obj;

    if (this.scoreDouble > paper.scoreDouble)
    {
        return -1;
    }
    else if (this.scoreDouble < paper.scoreDouble)
    {
        return +1;
    }
    else
        return 0;
}


So, this code will sort my array list based upon the scoreDouble field. And this works great, I just call it like this, Array.Sort(papers);, where papers is an un-sorted array of AdminPapers.

However, what if I want to sort papers a different way? Right now I only can sort the way I implemented Icomparable in AdminPapers. Is there a way to have two implementations? How do I do this? Right now the only sorting method I have is the CompareTo method above, is there a way to implement another?

/\ |_ E X E GG

-- modified at 20:48 Saturday 13th May, 2006
AnswerRe: IComparable interface *2 Pin
led mike13-May-06 17:05
led mike13-May-06 17:05 
AnswerRe: IComparable interface *2 Pin
Josh Smith13-May-06 17:44
Josh Smith13-May-06 17:44 
Question[Access database] how to get the last row inserted? Pin
Susuko13-May-06 12:55
Susuko13-May-06 12:55 
AnswerRe: [Access database] how to get the last row inserted? Pin
NaNg1524113-May-06 17:52
NaNg1524113-May-06 17:52 
AnswerRe: [Access database] how to get the last row inserted? Pin
mav.northwind14-May-06 1:09
mav.northwind14-May-06 1:09 
QuestionPreferred WPF Dev Tools Pin
Josh Smith13-May-06 12:40
Josh Smith13-May-06 12:40 
AnswerRe: Preferred WPF Dev Tools Pin
Rei Miyasaka14-May-06 15:48
Rei Miyasaka14-May-06 15:48 
GeneralRe: Preferred WPF Dev Tools Pin
Josh Smith15-May-06 3:55
Josh Smith15-May-06 3:55 
QuestionDelegates and events Pin
rcwoods13-May-06 9:11
rcwoods13-May-06 9:11 
AnswerRe: Delegates and events Pin
Guffa13-May-06 9:22
Guffa13-May-06 9:22 
GeneralRe: Delegates and events Pin
rcwoods13-May-06 10:16
rcwoods13-May-06 10:16 
QuestionFTP delete folders with all subfolders and containing files Pin
black_raven_in_black_sky13-May-06 8:35
black_raven_in_black_sky13-May-06 8:35 
AnswerRe: FTP delete folders with all subfolders and containing files Pin
simplexe14-May-06 1:14
simplexe14-May-06 1:14 
GeneralRe: FTP delete folders with all subfolders and containing files Pin
black_raven_in_black_sky14-May-06 5:49
black_raven_in_black_sky14-May-06 5:49 
GeneralRe: FTP delete folders with all subfolders and containing files Pin
simplexe14-May-06 19:24
simplexe14-May-06 19:24 
GeneralRe: FTP delete folders with all subfolders and containing files Pin
black_raven_in_black_sky16-May-06 3:08
black_raven_in_black_sky16-May-06 3:08 
GeneralRe: FTP delete folders with all subfolders and containing files Pin
simplexe17-May-06 2:27
simplexe17-May-06 2:27 

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.