C#/WPF

[C# / WPF] 비동기스레드

F급 개발자 2023. 7. 25. 07:33
728x90
반응형
private async Task Run()
{
    await Task.Run(async () =>
    {
       var stopwatch = System.Diagnostics.Stopwatch.StartNew();
       while (true)
       {
           //비동기로 처리할 로직 작성
           Tb_num = Convert.ToString(num++);

          await Task.Delay(100);
       }
   });
}

 

비동기스레드 입니다. While문 안에 비동기로 처리할 로직을 작성하시면 됩니다.

 

- 실행결과

728x90
반응형