Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
GeneralRe: Upload Pic... Pin
Manas Bhardwaj18-Jul-09 8:20
professionalManas Bhardwaj18-Jul-09 8:20 
QuestionHow to add...... Pin
mjawadkhatri17-Jul-09 18:53
mjawadkhatri17-Jul-09 18:53 
AnswerRe: How to add...... Pin
K030617-Jul-09 19:15
K030617-Jul-09 19:15 
QuestionMultiple Field Sorting C# Pin
dsrao17-Jul-09 18:46
dsrao17-Jul-09 18:46 
AnswerRe: Multiple Field Sorting C# Pin
Uri Lavi17-Jul-09 19:26
Uri Lavi17-Jul-09 19:26 
GeneralRe: Multiple Field Sorting C# Pin
dsrao18-Jul-09 9:12
dsrao18-Jul-09 9:12 
AnswerRe: Multiple Field Sorting C# Pin
riced17-Jul-09 20:49
riced17-Jul-09 20:49 
GeneralRe: Multiple Field Sorting C# Pin
Luc Pattyn17-Jul-09 23:55
sitebuilderLuc Pattyn17-Jul-09 23:55 
riced wrote:
Item other = (Item) obj;
If this.Name < other.Name return -1;
If this.Name > other.Name return 1;
If this.Cost > other.Cost return 1;
If this.Cost < other.Cost return -1;
return 0;


Item other = (Item) obj;
int diff=string.Compare(this.Name, other.Name);
if (diff==0) diff=this.Cost-other.Cost;
return diff;


And using a generic IComparable, you wouldn't need the cast.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: Multiple Field Sorting C# Pin
riced18-Jul-09 0:11
riced18-Jul-09 0:11 
GeneralRe: Multiple Field Sorting C# Pin
dsrao18-Jul-09 9:13
dsrao18-Jul-09 9:13 
QuestionProcess.workingset Pin
hpydir17-Jul-09 14:53
hpydir17-Jul-09 14:53 
AnswerRe: Process.workingset Pin
Luc Pattyn17-Jul-09 15:03
sitebuilderLuc Pattyn17-Jul-09 15:03 
Questionhelp Pin
unlucky_dreamer17-Jul-09 12:45
unlucky_dreamer17-Jul-09 12:45 
AnswerRe: help Pin
DaveyM6917-Jul-09 13:20
professionalDaveyM6917-Jul-09 13:20 
GeneralRe: help Pin
Michael Schubert17-Jul-09 22:06
Michael Schubert17-Jul-09 22:06 
QuestionMS Word Automation - Combining word documents Pin
venadder17-Jul-09 11:25
venadder17-Jul-09 11:25 
QuestionDelegates - I don't Get It Pin
eddieangel17-Jul-09 7:52
eddieangel17-Jul-09 7:52 
AnswerRe: Delegates - I don't Get It Pin
harold aptroot17-Jul-09 8:14
harold aptroot17-Jul-09 8:14 
AnswerRe: Delegates - I don't Get It Pin
CodingYoshi17-Jul-09 8:20
CodingYoshi17-Jul-09 8:20 
GeneralRe: Delegates - I don't Get It Pin
eddieangel17-Jul-09 8:35
eddieangel17-Jul-09 8:35 
GeneralRe: Delegates - I don't Get It Pin
DaveyM6917-Jul-09 10:47
professionalDaveyM6917-Jul-09 10:47 
GeneralRe: Delegates - I don't Get It Pin
eddieangel17-Jul-09 11:00
eddieangel17-Jul-09 11:00 
GeneralRe: Delegates - I don't Get It Pin
DaveyM6917-Jul-09 11:26
professionalDaveyM6917-Jul-09 11:26 
GeneralRe: Delegates - I don't Get It Pin
DaveyM6917-Jul-09 11:39
professionalDaveyM6917-Jul-09 11:39 
AnswerRe: Delegates - I don't Get It Pin
Luc Pattyn17-Jul-09 10:13
sitebuilderLuc Pattyn17-Jul-09 10:13 

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.