Example #1
0
        /// <summary>
        /// A quick filter method.
        /// </summary>
        public async AsyncSequence <T> Where(Func <T, bool> condition)
        {
            var seq = await AsyncSequence <T> .Capture();

            while (await MoveNextAsync())
            {
                if (condition(Current))
                {
                    seq.Return(Current);
                }
            }

            return(seq.Break());
        }
Example #2
0
        internal AsyncSequenceMethodBuilder(AsyncSequence <T> task)
        {
            _methodBuilder = AsyncTaskMethodBuilder <T> .Create();

            Task = task;
        }