Click here to Skip to main content
15,891,708 members
Home / Discussions / C#
   

C#

 
GeneralRe: Multiplatform (32bits/64bits/CE) & Interop Pin
Super Lloyd19-Jun-06 22:17
Super Lloyd19-Jun-06 22:17 
GeneralRe: Multiplatform (32bits/64bits/CE) & Interop Pin
Super Lloyd20-Jun-06 5:40
Super Lloyd20-Jun-06 5:40 
QuestionXSL:, XMLDOM C# Pin
Ramon Gzz M19-Jun-06 16:10
Ramon Gzz M19-Jun-06 16:10 
QuestionMicrosoft Word/Excel Automation Errors [modified] Pin
dbloch19-Jun-06 15:19
dbloch19-Jun-06 15:19 
QuestionUser settings for application Pin
Mike0919-Jun-06 14:27
Mike0919-Jun-06 14:27 
AnswerRe: User settings for application Pin
Mike Poz19-Jun-06 15:03
Mike Poz19-Jun-06 15:03 
QuestionHow to get distinct items from an array? Pin
mejobloggs19-Jun-06 13:34
mejobloggs19-Jun-06 13:34 
AnswerRe: How to get distinct items from an array? Pin
Alexander Wiseman19-Jun-06 14:04
Alexander Wiseman19-Jun-06 14:04 
There a couple of ways you could attack this, depending on speed and space considerations. Here they are theoretically:

1) Sort the array list, then go through and call ArrayList.RemoveAt to chop out any duplicates in a simple loop through the sorted array.

2) Copy the ArrayList over to another ArrayList item by item, but each time, before you add an item, call ArrayList.Contains to check if the NEW array already contains the value you are trying to add from the OLD array.

3) Copy the ArrayList over to a Hashtable item by item, making the key the items in your array, and each time call Hashtable.ContainsKey to check if you've already added a value from the array.

These were a couple of the ways I could think of. There are probably others and more efficient, but these will get the job done. I wouldn't recommend using number 3 unless time is a real consideration. Number 2 is going to take much longer if you have a long array, because this will be looping through the array as many times as you have items. Number 1 can be longer or shorter depending on the sort algorithm you have.

Hope that helps!

Sincerely,
Alexander Wiseman
GeneralRe: How to get distinct items from an array? Pin
mejobloggs19-Jun-06 15:57
mejobloggs19-Jun-06 15:57 
GeneralRe: How to get distinct items from an array? Pin
leppie19-Jun-06 22:07
leppie19-Jun-06 22:07 
GeneralRe: How to get distinct items from an array? Pin
Alexander Wiseman20-Jun-06 5:43
Alexander Wiseman20-Jun-06 5:43 
AnswerRe: How to get distinct items from an array? Pin
Leslie Sanford19-Jun-06 16:43
Leslie Sanford19-Jun-06 16:43 
GeneralRe: How to get distinct items from an array? Pin
mejobloggs19-Jun-06 17:09
mejobloggs19-Jun-06 17:09 
AnswerRe: How to get distinct items from an array? Pin
Judah Gabriel Himango19-Jun-06 18:22
sponsorJudah Gabriel Himango19-Jun-06 18:22 
QuestionProcess.Start() mailto exception - default mail client Pin
stretchtack19-Jun-06 13:11
stretchtack19-Jun-06 13:11 
AnswerRe: Process.Start() mailto exception - default mail client Pin
Alexander Wiseman19-Jun-06 13:54
Alexander Wiseman19-Jun-06 13:54 
GeneralRe: Process.Start() mailto exception - default mail client Pin
stretchtack19-Jun-06 19:20
stretchtack19-Jun-06 19:20 
GeneralSTAThread vs. MTAThread - Process.Start() Pin
stretchtack20-Jun-06 7:28
stretchtack20-Jun-06 7:28 
GeneralRe: STAThread vs. MTAThread - Process.Start() Pin
Alexander Wiseman20-Jun-06 8:46
Alexander Wiseman20-Jun-06 8:46 
QuestionSession State Transfer Pin
Expert Coming19-Jun-06 11:39
Expert Coming19-Jun-06 11:39 
QuestionNeural networks in c# Pin
yasar khan19-Jun-06 10:46
yasar khan19-Jun-06 10:46 
AnswerRe: Neural networks in c# Pin
Colin Angus Mackay19-Jun-06 11:13
Colin Angus Mackay19-Jun-06 11:13 
AnswerRe: Neural networks in c# Pin
Ravi Bhavnani19-Jun-06 11:39
professionalRavi Bhavnani19-Jun-06 11:39 
AnswerRe: Neural networks in c# Pin
User 171649219-Jun-06 13:29
professionalUser 171649219-Jun-06 13:29 
Questionexecting .bat file. Pin
tom laz19-Jun-06 10:29
tom laz19-Jun-06 10:29 

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.