Пример #1
0
        public async IAsyncEnumerable <int> InstanceMethodsHaveAsynchronousEquivalentsWithLocalFunctionYielding()
        {
            var @object = new ClassWithAsyncEquivalents();

            @object.SaveChanges();
            @object.Abort();
            @object.AcceptSocket();
            @object.AcceptTcpClient();
            @object.AccessFailed();

            yield return(0);

            YieldSomething();

            IEnumerable <int> YieldSomething()
            {
                for (int i = 0; i < 100; i++)
                {
                    @object.SaveChanges();
                    @object.Abort();
                    @object.AcceptSocket();
                    @object.AcceptTcpClient();
                    @object.AccessFailed();

                    yield return(i);
                }

                yield break;
            }
        }
Пример #2
0
        public async IAsyncEnumerable <int> InstanceMethodsHaveAsynchronousEquivalents()
        {
            var @object = new ClassWithAsyncEquivalents();

            @object.SaveChanges();
            @object.Abort();
            @object.AcceptSocket();
            @object.AcceptTcpClient();
            @object.AccessFailed();

            yield return(0);
        }
Пример #3
0
 public static bool AccessFailed(this ClassWithAsyncEquivalents @object) => true;
Пример #4
0
 public static Task <bool> AcceptTcpClientAsync(this ClassWithAsyncEquivalents @object) => new Task <bool>(() => true);