WE ARE SHARING
OUR EXPERIANCE.
BELIEVE THE POWER OF SHARE
BLOG
10 Jul
C # Linq "Except" Command To Get Directory Aware
With C # Linq, it is possible to find the first array in two different arrays and not the different values in the second array. This example is also the first string, a new string containing the second non-string values is created and the values are written on the screen.
public void Linq()
{
int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 };
int[] numbersB = { 1, 3, 5, 7, 8 };
IEnumerable<int> aOnlyNumbers = numbersA.Except(numbersB);
Console.WriteLine("Numbers in first array but not second array:");
foreach (var n in aOnlyNumbers)
{ Console.WriteLine(n);
}
}
Output;
Numbers in first array but not second array:
0
2
4
6
9