Well, this is implementation-specific, so theoretically this can change, but basically the difference is that with the help of HashSet.IntersectWithyou start with a hash set, so you only need to iterate over one collection.
“Obvious” implementations would mean the complexity of O (M + N) and O (N) for Intersectand IntersectWithrespectively - provided, of course, a decent hash code. I would be very surprised to see any other implementation, and of course I did not see any evidence that any version of .NET was sent with something else.
, Intersect HashSet<T>, , , . , , Intersect.
. Edulinq , MSDN. MSDN ( ), :
, , , Intersect , . , , . , , .
, :
- It
second, (, MoveNext() ) first - , " , ", MSDN