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

C#

 
GeneralArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 6:53
Luis Alonso Ramos23-Jul-05 6:53 
GeneralRe: ArrayList of value types Pin
KaptinKrunch23-Jul-05 7:26
KaptinKrunch23-Jul-05 7:26 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 7:45
Wyxlwiis23-Jul-05 7:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 8:27
Luis Alonso Ramos23-Jul-05 8:27 
GeneralRe: ArrayList of value types Pin
DavidNohejl23-Jul-05 8:45
DavidNohejl23-Jul-05 8:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 9:38
Luis Alonso Ramos23-Jul-05 9:38 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 10:11
Wyxlwiis23-Jul-05 10:11 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 15:10
Luis Alonso Ramos23-Jul-05 15:10 
I'm using primitive types (ints). Actually I'm implementing multi-column sorting for a list view control (it will come as a CP article Smile | :) ) and I have to keep track of all columns clicked by the user. If the user clicks one column, clicks another one, and then click the first again, I have to remove it from the list and add it again at the end. Also if the user clicks twice in a row the same column, I have to togle its sign (indicating descending order.)

So, when I create a comparer object to set the ListViewSorter (or something like that) property, I pass this ArrayList as a parameter, and each time Compare is called to compare two items, I have to compare the items according to the columns in the order they are in the ArrayList. Bsically I used a foreach(int i in ArrayList) and compared the subitems in column i, and if they were the same, checked the next column.

After your first suggestion, in the constructor I converted the ArrayList to a regular array, and the same code (measured with a profiler) runs about 18% faster.

Wyxlwiis wrote:
Hopfully im not waisting your time with my suggestion

Not at all. I appreciate it very much. Thanks!

-- LuisR




Luis Alonso Ramos
Intelectix - Chihuahua, Mexico

Not much here: My CP Blog!

GeneralRe: ArrayList of value types Pin
LongRange.Shooter25-Jul-05 10:17
LongRange.Shooter25-Jul-05 10:17 
QuestionConnection Database? Pin
pmasknguyen23-Jul-05 6:01
pmasknguyen23-Jul-05 6:01 
AnswerRe: Connection Database? Pin
Christian Graus23-Jul-05 11:05
protectorChristian Graus23-Jul-05 11:05 
QuestionHow to deal with Mouse Events & custom events in a component? Pin
Cheng Zhong23-Jul-05 5:53
Cheng Zhong23-Jul-05 5:53 
AnswerRe: How to deal with Mouse Events & custom events in a component? Pin
Anonymous23-Jul-05 18:35
Anonymous23-Jul-05 18:35 
GeneralRe: How to deal with Mouse Events & custom events in a component? Pin
Cheng Zhong24-Jul-05 2:36
Cheng Zhong24-Jul-05 2:36 
GeneralRe: How to deal with Mouse Events & custom events in a component? Pin
Anonymous24-Jul-05 7:12
Anonymous24-Jul-05 7:12 
GeneralUnhandled Exception Pin
Mingzhi_8623-Jul-05 2:59
Mingzhi_8623-Jul-05 2:59 
GeneralRe: Unhandled Exception Pin
EssOEss23-Jul-05 3:57
EssOEss23-Jul-05 3:57 
GeneralRe: Unhandled Exception Pin
Mingzhi_8623-Jul-05 17:46
Mingzhi_8623-Jul-05 17:46 
GeneralText in a listview column Pin
Haim Yulzari23-Jul-05 2:52
Haim Yulzari23-Jul-05 2:52 
GeneralRe: Text in a listview column Pin
Anonymous23-Jul-05 18:30
Anonymous23-Jul-05 18:30 
GeneralRe: Text in a listview column Pin
Haim Yulzari24-Jul-05 1:49
Haim Yulzari24-Jul-05 1:49 
Generalsigning and strong names Pin
dirkhelmet!@yahoo.com23-Jul-05 2:13
dirkhelmet!@yahoo.com23-Jul-05 2:13 
GeneralRe: signing and strong names Pin
Rob Graham23-Jul-05 4:19
Rob Graham23-Jul-05 4:19 
GeneralWSA Cancell Blocking Call Socket Exception Pin
meetsukant23-Jul-05 1:55
meetsukant23-Jul-05 1:55 
Generalexpression evaluation Pin
khalouda23-Jul-05 0:07
khalouda23-Jul-05 0:07 

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.