public static bool EnumeratorTest(byte[] a, byte[] b) { int sum = 0; var enumerator = Enumerator <byte> .Create(a); while (enumerator.Next()) { sum += enumerator.Value; } OnNotify("aa", sum); sum = 0; var enumeratorA = Enumerator <byte> .Create(a); var enumeratorB = Enumerator <byte> .Create(b); var enumeratorC = enumeratorA.Concat(enumeratorB); while (enumeratorC.Next()) { sum += enumeratorC.Value; } OnNotify("aa", sum); return(true); }
public static Enumerator <int> TestIntEnumerator() { var enumerator = Enumerator <int> .Create(new int[3] { 4, 6, 8 }); return(enumerator); }
public void EnumerableFromEnumerator() { IEnumerable <DateTime> enumerable = EnumerableEx.Create(() => Enumerator.Create( DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now)); _consumer.Consume(enumerable); }
public static int TestNext(byte[] a) { int sum = 0; var enumerator = Enumerator <byte> .Create(a); while (enumerator.Next()) { sum += enumerator.Value; } return(sum); }
public static int TestNextIntArray(int[] a) { int sum = 0; var enumerator = Enumerator <int> .Create(a); while (enumerator.Next()) { sum += enumerator.Value; } return(sum); }
public static int TestConcat(byte[] a, byte[] b) { int sum = 0; var enumeratorA = Enumerator <byte> .Create(a); var enumeratorB = Enumerator <byte> .Create(b); var enumeratorC = enumeratorA.Concat(enumeratorB); while (enumeratorC.Next()) { sum += enumeratorC.Value; } return(sum); }
public IEnumerator <Layer> GetEnumerator() { return(Enumerator.Create(layers)); }
public static async Tasks.Task <Generic.IEnumerator <T> > WhenAll <T>(this Generic.IEnumerator <Tasks.Task <T> > me) { var current = await me.Next(); return(current.IsNull() ? Enumerator.Create(current) : (await me.WhenAll()).Prepend(current)); }
public static Generic.IEnumerator <Tasks.Task <T> > FilterTasks <T>(this Generic.IEnumerator <Tasks.Task <T> > me, Func <T, bool> predicate) { return(Enumerator.Create(() => me.FilterNext(predicate), me.Reset, me.Dispose)); }
public IEnumerator <object> GetEnumerator() => Enumerator.Create(this);