Ejemplo n.º 1
0
        public static async Task Test()
        {
            Task <int> task;

            using (var resource = new DisposedAsync()) {
                task = resource.GetDataAsync();
            }
            var ret = await task;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var myClassBuild = AsyncConstructorClass.CreateInstanceAsync();

            Console.WriteLine("before constructor");
            Console.WriteLine(myClassBuild.Result.ToString());

            DisposedAsync disposedAsync = new DisposedAsync();

            AsyncContext.Run(() => Test());
            Console.WriteLine("Hello World!");
        }