using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Caller();
            Console.ReadLine();
        }

        async static private void memethodAsync(int count)
        {
            Console.WriteLine("C");
            Console.WriteLine("D");

            await Task.Run(async () =>
            {
                for (int i = 1; i <= count; i++)
                {
                    Console.WriteLine(i.ToString());

                }
            }
            );
            Console.WriteLine("G");
            Console.WriteLine("H");
        }


        static void Caller()
        {
            Console.WriteLine("A");
            Console.WriteLine("B");

            memethodAsync(5);

            Console.WriteLine("E");
            Console.WriteLine("F");
        }
   
   
    }
}


결과


A
B
C
D
E
F
1
2
3
4
5
G
H

 

'C#' 카테고리의 다른 글

(WPF) wpf 관련 리소스 정리  (0) 2017.04.13
(WPF) 챨스패졸드 책 정리  (0) 2017.04.13
(.NET) async, await 비동기 샘플 코드  (0) 2017.04.13
(.NET) 이펙티브 C# - 요점 정리  (0) 2017.04.13
(WCF) .net CORE WCF  (0) 2017.04.13
(WCF) Setting  (0) 2017.04.13

+ Recent posts