Beispiel #1
0
            public override async Task <bool> MoveNextAsync()
            {
                switch (_state)
                {
                case 1:
                    _enumerator = _source.GetAsyncEnumerator();
                    _state      = 2;
                    goto case 2;

                case 2:
                    do
                    {
                        while (true)
                        {
                            var item = _enumerator.TryGetNext(out var success);

                            if (!success)
                            {
                                break;
                            }
                            else
                            {
                                _current = item;
                                return(true);
                            }
                        }
                    } while (await _enumerator.WaitForNextAsync().ConfigureAwait(false));

                    break;
                }

                return(false);
            }
Beispiel #2
0
            public override Task <bool> WaitForNextAsync()
            {
                switch (_state)
                {
                case 1:
                    _enumerator = _source.GetAsyncEnumerator();
                    _state      = 2;
                    goto case 2;

                case 2:
                    return(_enumerator.WaitForNextAsync());
                }

                return(False);
            }
Beispiel #3
0
            public override async Task <bool> WaitForNextAsync()
            {
                switch (_state)
                {
                case 1:
                    _enumerator = _source.GetAsyncEnumerator();
                    _state      = 2;
                    goto case 2;

                case 2:
                    do
                    {
                        while (true)
                        {
                            var item = _enumerator.TryGetNext(out var success);

                            if (!success)
                            {
                                break;
                            }
                            else
                            {
                                if (await _predicate(item).ConfigureAwait(false))
                                {
                                    _hasNext = true;
                                    _next    = item;
                                    return(true);
                                }
                            }
                        }
                    }while (await _enumerator.WaitForNextAsync().ConfigureAwait(false));

                    break;
                }

                _hasNext = false;
                _next    = default(T);

                return(false);
            }