How to get difference between two array without using linq or Set operator using csharp ?
How to get difference between two array without using linq or Set operator using csharp ?
(OP)
I work on csharp
I have two arrays of string
A1 = [Watermelon, Apple, Mango, Guava, Banana]
A2 = [Orange, Kiwi, Apple, Watermelon]
i need to write code by csharp get difference between two arrays
and display difference between two arrays but without using linq or set operator
expected result
Mango
Guava
Orange
Kiwi
I have two arrays of string
A1 = [Watermelon, Apple, Mango, Guava, Banana]
A2 = [Orange, Kiwi, Apple, Watermelon]
i need to write code by csharp get difference between two arrays
and display difference between two arrays but without using linq or set operator
expected result
Mango
Guava
Orange
Kiwi
RE: How to get difference between two array without using linq or Set operator using csharp ?
RE: How to get difference between two array without using linq or Set operator using csharp ?
correct
sorry for missed Banana
expected result will be
expected result
Mango
Guava
Banana
Orange
Kiwi
RE: How to get difference between two array without using linq or Set operator using csharp ?
RE: How to get difference between two array without using linq or Set operator using csharp ?
RE: How to get difference between two array without using linq or Set operator using csharp ?
var array1 = new[] { "Watermelon", "Apple", "Mango", "Guava", "Banana" };
var array2 = new[] { "Orange", "Kiwi", "Apple", "Watermelon" };
var result = array2.Except(array1).Concat(array1.Except(array2));
but i need it to get result without using linq or set operator
RE: How to get difference between two array without using linq or Set operator using csharp ?
iterate over first array and check every element if it is in the second array too - and if not then this is the different element.
Then do the same with the second array.
RE: How to get difference between two array without using linq or Set operator using csharp ?
CODE
Output:
CODE
RE: How to get difference between two array without using linq or Set operator using csharp ?