Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
AnswerRe: backspace Pin
coolestCoder17-Aug-06 19:50
coolestCoder17-Aug-06 19:50 
AnswerRe: backspace Pin
stancrm17-Aug-06 22:06
stancrm17-Aug-06 22:06 
QuestionAutomatically uppercase event handlers Pin
Joe Woodbury17-Aug-06 17:45
professionalJoe Woodbury17-Aug-06 17:45 
AnswerRe: Automatically uppercase event handlers Pin
Christian Graus17-Aug-06 17:50
protectorChristian Graus17-Aug-06 17:50 
GeneralRe: Automatically uppercase event handlers Pin
Joe Woodbury17-Aug-06 17:52
professionalJoe Woodbury17-Aug-06 17:52 
Questionhave anyone use carbon or razor framework? Pin
adong200617-Aug-06 16:33
adong200617-Aug-06 16:33 
QuestionSqlDependency and which rows actually changed? Pin
rpheaney17-Aug-06 14:55
rpheaney17-Aug-06 14:55 
QuestionComparing 2 arrays and retreiving the difference Pin
loneferret17-Aug-06 14:53
loneferret17-Aug-06 14:53 
Hello,
Have a question. Trying to compare 2 arrays and adding the difference in a 3rd.
Array1 has {hello,bye,goodluck,bonjour} and Array2{hello,bye,bonjour}, and the
third should then get {goodluck}

Now, I found a way, but.. it's just plain cheap in my opinion and I'm sure there's a better, faster way of doing this. Here's what I got.

int count=0;
string[] array1 = new string[5];
string[] array2 = new string[3];
ArrayList array3 = new Arraylist(array1.length - array2.length);
for (int x = 1; x < array1.Length; x++){
    listLocal.Items.Add(array1[x].ToString());
    for(int y = 1; y < array2.Length;y++){
       if (!local[x].Contains(array2[y].ToString()))
           count++;
       if(count==array2.Length-1)
           array3.Add(array1[x].ToString());
    }
    count = 0;
}

Of course the way the code is now, it means that array1 while always
be larger then array2, so when array2 is larger I have to place another if statement.
So please, what's the better way? Show me the light and release me from these infernal
"IF"s and "FOR"s .. Smile | :)

Thank you,


Loneferret
_____________________________________________________________________
Cross my heart, smack me dead...stick a lobster on my head.

AnswerRe: Comparing 2 arrays and retreiving the difference Pin
Christian Graus17-Aug-06 14:58
protectorChristian Graus17-Aug-06 14:58 
GeneralRe: Comparing 2 arrays and retreiving the difference [modified] Pin
loneferret17-Aug-06 15:34
loneferret17-Aug-06 15:34 
QuestionAdd flash content in custom control C#.NET file Pin
Dpriya17-Aug-06 12:15
Dpriya17-Aug-06 12:15 
AnswerRe: Add flash content in custom control C#.NET file Pin
Corinna John17-Aug-06 20:27
Corinna John17-Aug-06 20:27 
QuestionStoring Size&Position of WindowForms Pin
Frygreen17-Aug-06 11:00
Frygreen17-Aug-06 11:00 
AnswerRe: Storing Size&Position of WindowForms Pin
Ennis Ray Lynch, Jr.17-Aug-06 12:19
Ennis Ray Lynch, Jr.17-Aug-06 12:19 
QuestionComboBox/CheckBox background color when disabled. [modified] Pin
sykiemikey17-Aug-06 10:54
sykiemikey17-Aug-06 10:54 
AnswerRe: ComboBox/CheckBox background color when disabled. Pin
Nader Elshehabi17-Aug-06 19:02
Nader Elshehabi17-Aug-06 19:02 
GeneralRe: ComboBox/CheckBox background color when disabled. Pin
sykiemikey17-Aug-06 20:58
sykiemikey17-Aug-06 20:58 
GeneralRe: ComboBox/CheckBox background color when disabled. Pin
sykiemikey17-Aug-06 23:16
sykiemikey17-Aug-06 23:16 
GeneralRe: ComboBox/CheckBox background color when disabled. Pin
Nader Elshehabi18-Aug-06 5:20
Nader Elshehabi18-Aug-06 5:20 
QuestionReading Image from this link Pin
mm31017-Aug-06 10:49
mm31017-Aug-06 10:49 
AnswerRe: Reading Image from this link Pin
mm31018-Aug-06 2:17
mm31018-Aug-06 2:17 
Questionwhy multiple class inheritance is not supported in C# .NET Pin
For_IT17-Aug-06 10:23
For_IT17-Aug-06 10:23 
AnswerRe: why multiple class inheritance is not supported in C# .NET Pin
Ravi Bhavnani17-Aug-06 10:48
professionalRavi Bhavnani17-Aug-06 10:48 
AnswerRe: why multiple class inheritance is not supported in C# .NET Pin
Kevin McFarlane17-Aug-06 11:38
Kevin McFarlane17-Aug-06 11:38 
AnswerRe: why multiple class inheritance is not supported in C# .NET Pin
Joe Woodbury17-Aug-06 17:52
professionalJoe Woodbury17-Aug-06 17:52 

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.