Find the not-existing element in int arrays.
-
Hi all, I've two int arrays, something like this. {41, 3, 5, 37, 59, 4} {3, 59, 4, 5, 37} As you can see 41 is not in the second array. I want to find that actually in a C# code. Basically I want to find the value which is exists only in one array. Any comments? Thanks a lot. :)
I appreciate your help all the time... CodingLover :)
-
Hi all, I've two int arrays, something like this. {41, 3, 5, 37, 59, 4} {3, 59, 4, 5, 37} As you can see 41 is not in the second array. I want to find that actually in a C# code. Basically I want to find the value which is exists only in one array. Any comments? Thanks a lot. :)
I appreciate your help all the time... CodingLover :)
-
Hi all, I've two int arrays, something like this. {41, 3, 5, 37, 59, 4} {3, 59, 4, 5, 37} As you can see 41 is not in the second array. I want to find that actually in a C# code. Basically I want to find the value which is exists only in one array. Any comments? Thanks a lot. :)
I appreciate your help all the time... CodingLover :)
Enumerable.Except (since .NET 3.5) Dust Signs
The number you dialed is imaginary. Please turn your phone by 90 degrees and try again
-
Enumerable.Except (since .NET 3.5) Dust Signs
The number you dialed is imaginary. Please turn your phone by 90 degrees and try again
:thumbsup:
himanshu
-
There might be a simpler way, but try just to iterate through the two arrays with a nested for loop and se if the items in the first array exist in the second.
Actually I've look at that, have no clue about that's the best way I can take.
I appreciate your help all the time... CodingLover :)
-
Hi all, I've two int arrays, something like this. {41, 3, 5, 37, 59, 4} {3, 59, 4, 5, 37} As you can see 41 is not in the second array. I want to find that actually in a C# code. Basically I want to find the value which is exists only in one array. Any comments? Thanks a lot. :)
I appreciate your help all the time... CodingLover :)
Sounds like a set operation, I'd use sets.
-
Enumerable.Except (since .NET 3.5) Dust Signs
The number you dialed is imaginary. Please turn your phone by 90 degrees and try again
Thanks a lot. Actually now my application have a slight change. Now all my elements are in a list. So I've two lists now. So how can I do this. Thanks :)
I appreciate your help all the time... CodingLover :)
-
Thanks a lot. Actually now my application have a slight change. Now all my elements are in a list. So I've two lists now. So how can I do this. Thanks :)
I appreciate your help all the time... CodingLover :)
Which list are you using exactly? A generic List? As it also implements IEnumerable you should be able to use the extension methods on them equally. Dust Signs
The number you dialed is imaginary. Please turn your phone by 90 degrees and try again