コード例 #1
0
        public async void InstanceMethodsHaveAsynchronousEquivalentsWithLocalFunctionYielding()
        {
            var @object = new ClassWithAsyncEquivalents();

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

            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 void InstanceMethodsHaveAsynchronousEquivalents()
        {
            var @object = new ClassWithAsyncEquivalents();

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