Example
Here is an example of the code I found on the Pete on Software blog :
var listThree = new string[] { "Pete", "On", "Software" };
var listFour = new string[] { "Joel", "On", "Software" };
stringExcept = listThree.Except(listFour);
The code compiles and runs. So far so good.
Question
However, I do not understand why it works.
So, can anyone explain why I can use Enumerable.Exceptin an array of strings?
Perhaps it will be clear to me if anyone can explain how to read the signature Enumerable.Exceptand give me a code example:
public static IEnumerable<TSource> Except<TSource>(
this IEnumerable<TSource> first,
IEnumerable<TSource> second
)
What i know
I know the concepts of generics and extension methods. But, obviously, itβs not good enough to understand the code example above. I also already used some basic Linq queries.
source
share