예제 #1
0
 internal static void ForEach <T>(GenericSequence <T> sequence, Action <T> processNext)
 {
     foreach (T value in sequence)
     {
         processNext(value);
     }
 }
예제 #2
0
        internal static void CompiledForEach <T>(GenericSequence <T> sequence, Action <T> process)
        {
            GenericIterator <T> iterator = sequence.GetEnumerator();

            try
            {
                while (iterator.MoveNext())
                {
                    T value = iterator.Current;
                    process(value);
                }
            }
            finally
            {
                (iterator as IDisposable)?.Dispose();
            }
        }