Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: GC-Like Slowdown [modified] Pin
Andrew Shapira5-Dec-06 11:18
Andrew Shapira5-Dec-06 11:18 
Questionquestion about creating subdomain name Pin
abstar4-Dec-06 11:54
abstar4-Dec-06 11:54 
AnswerRe: question about creating subdomain name Pin
leppie4-Dec-06 22:19
leppie4-Dec-06 22:19 
Questionuploading file Pin
netJP12L4-Dec-06 11:37
netJP12L4-Dec-06 11:37 
AnswerRe: uploading file Pin
Christian Graus4-Dec-06 11:44
protectorChristian Graus4-Dec-06 11:44 
GeneralRe: uploading file Pin
netJP12L4-Dec-06 12:01
netJP12L4-Dec-06 12:01 
GeneralRe: uploading file Pin
Christian Graus4-Dec-06 12:06
protectorChristian Graus4-Dec-06 12:06 
Questionsorting an ArrayList with different attributes Pin
Mostafa Siraj4-Dec-06 10:48
Mostafa Siraj4-Dec-06 10:48 
hi all
since i can't describe my problem well, plz check this code,
in this code i can sort the list for the x variable -this is fine and working-
but wat if i want also to be able to sort the list with y variable as well.
i can only use IComparable.Compare with x, i want also to be able to sort the list for y variable

how can i do that????

thanks in advance

how can i do that

using System;
using System.Collections;
using System.Collections.Generic;

public class SamplesArrayList
{
public class Test : IComparable
{
public int x;

public int y;
//this is the variable which i want to sort the list with it also

public Test(int x)
{
this.x = x;
}
int IComparable.CompareTo(object x)
{
Test x1 = (Test)x;
return (this.x.CompareTo(x1.x));
}
}

public static void Main()
{
ArrayList test = new ArrayList();
Test l1 = new Test(7);
Test l2 = new Test(3);
Test l3 = new Test(9);
Test l4 = new Test(2);
Test l5 = new Test(4);
test.Add(l1);
test.Add(l2);
test.Add(l3);
test.Add(l4);
test.Add(l5);

test.Sort();

}
}



AnswerRe: sorting an ArrayList with different attributes Pin
Christian Graus4-Dec-06 11:09
protectorChristian Graus4-Dec-06 11:09 
GeneralRe: sorting an ArrayList with different attributes Pin
Mostafa Siraj4-Dec-06 11:19
Mostafa Siraj4-Dec-06 11:19 
GeneralRe: sorting an ArrayList with different attributes Pin
led mike4-Dec-06 11:24
led mike4-Dec-06 11:24 
GeneralRe: sorting an ArrayList with different attributes Pin
Mostafa Siraj4-Dec-06 11:27
Mostafa Siraj4-Dec-06 11:27 
GeneralRe: sorting an ArrayList with different attributes Pin
Christian Graus4-Dec-06 11:29
protectorChristian Graus4-Dec-06 11:29 
GeneralRe: sorting an ArrayList with different attributes Pin
Mostafa Siraj4-Dec-06 11:32
Mostafa Siraj4-Dec-06 11:32 
GeneralRe: sorting an ArrayList with different attributes Pin
Christian Graus4-Dec-06 11:42
protectorChristian Graus4-Dec-06 11:42 
GeneralRe: sorting an ArrayList with different attributes Pin
sanjaybs20014-Dec-06 21:06
sanjaybs20014-Dec-06 21:06 
GeneralRe: sorting an ArrayList with different attributes Pin
Christian Graus4-Dec-06 23:14
protectorChristian Graus4-Dec-06 23:14 
AnswerRe: sorting an ArrayList with different attributes Pin
Russell Jones4-Dec-06 21:02
Russell Jones4-Dec-06 21:02 
QuestionAccessViolationException was Handled Pin
Pokkri4-Dec-06 10:02
Pokkri4-Dec-06 10:02 
AnswerRe: AccessViolationException was Handled Pin
Christian Graus4-Dec-06 10:12
protectorChristian Graus4-Dec-06 10:12 
GeneralRe: AccessViolationException was Handled Pin
Pokkri5-Dec-06 1:08
Pokkri5-Dec-06 1:08 
QuestionFast loading images to a ImageList... Pin
Marcos Hernandez4-Dec-06 8:43
Marcos Hernandez4-Dec-06 8:43 
AnswerRe: Fast loading images to a ImageList... [modified] Pin
Luc Pattyn4-Dec-06 9:08
sitebuilderLuc Pattyn4-Dec-06 9:08 
GeneralRe: Fast loading images to a ImageList... Pin
Marcos Hernandez4-Dec-06 9:46
Marcos Hernandez4-Dec-06 9:46 
GeneralRe: Fast loading images to a ImageList... Pin
Luc Pattyn4-Dec-06 10:13
sitebuilderLuc Pattyn4-Dec-06 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.