internal override bool MoveNext(ref TInputOutput currentElement, ref int currentKey) { if (this.m_hashLookup == null) { this.m_outputLoopCount = new Shared <int>(0); this.m_hashLookup = new System.Linq.Parallel.Set <TInputOutput>(this.m_comparer); Pair <TInputOutput, NoKeyMemoizationRequired> pair = new Pair <TInputOutput, NoKeyMemoizationRequired>(); int num = 0; int num2 = 0; while (this.m_rightSource.MoveNext(ref pair, ref num)) { if ((num2++ & 0x3f) == 0) { CancellationState.ThrowIfCanceled(this.m_cancellationToken); } this.m_hashLookup.Add(pair.First); } } Pair <TInputOutput, NoKeyMemoizationRequired> pair2 = new Pair <TInputOutput, NoKeyMemoizationRequired>(); TLeftKey local = default(TLeftKey); while (this.m_leftSource.MoveNext(ref pair2, ref local)) { if ((this.m_outputLoopCount.Value++ & 0x3f) == 0) { CancellationState.ThrowIfCanceled(this.m_cancellationToken); } if (this.m_hashLookup.Add(pair2.First)) { currentElement = pair2.First; return(true); } } return(false); }
internal override bool MoveNext(ref TInputOutput currentElement, ref TLeftKey currentKey) { if (this.m_outputEnumerator == null) { System.Linq.Parallel.Set <TInputOutput> set = new System.Linq.Parallel.Set <TInputOutput>(this.m_comparer); Pair <TInputOutput, NoKeyMemoizationRequired> pair = new Pair <TInputOutput, NoKeyMemoizationRequired>(); int num = 0; int num2 = 0; while (this.m_rightSource.MoveNext(ref pair, ref num)) { if ((num2++ & 0x3f) == 0) { CancellationState.ThrowIfCanceled(this.m_cancellationToken); } set.Add(pair.First); } Dictionary <Wrapper <TInputOutput>, Pair <TInputOutput, TLeftKey> > dictionary = new Dictionary <Wrapper <TInputOutput>, Pair <TInputOutput, TLeftKey> >(new WrapperEqualityComparer <TInputOutput>(this.m_comparer)); Pair <TInputOutput, NoKeyMemoizationRequired> pair2 = new Pair <TInputOutput, NoKeyMemoizationRequired>(); TLeftKey local = default(TLeftKey); while (this.m_leftSource.MoveNext(ref pair2, ref local)) { if ((num2++ & 0x3f) == 0) { CancellationState.ThrowIfCanceled(this.m_cancellationToken); } if (!set.Contains(pair2.First)) { Pair <TInputOutput, TLeftKey> pair3; Wrapper <TInputOutput> key = new Wrapper <TInputOutput>(pair2.First); if (!dictionary.TryGetValue(key, out pair3) || (this.m_leftKeyComparer.Compare(local, pair3.Second) < 0)) { dictionary[key] = new Pair <TInputOutput, TLeftKey>(pair2.First, local); } } } this.m_outputEnumerator = dictionary.GetEnumerator(); } if (this.m_outputEnumerator.MoveNext()) { Pair <TInputOutput, TLeftKey> pair4 = this.m_outputEnumerator.Current.Value; currentElement = pair4.First; currentKey = pair4.Second; return(true); } return(false); }
internal DistinctQueryOperatorEnumerator(QueryOperatorEnumerator <Pair <TInputOutput, NoKeyMemoizationRequired>, TKey> source, IEqualityComparer <TInputOutput> comparer, CancellationToken cancellationToken) { this.m_source = source; this.m_hashLookup = new System.Linq.Parallel.Set <TInputOutput>(comparer); this.m_cancellationToken = cancellationToken; }