Using async without await in C#?

前端 未结 4 975
别那么骄傲
别那么骄傲 2020-12-05 04:43

Consider Using async without await.

think that maybe you misunderstand what async does. The warning is exactly right: if you mark your method async

4条回答
  •  暖寄归人
    2020-12-05 05:09

    If Logger.LogInfo is a synchronous method, the whole call will be synchronous anyway. If all you want to do is to execute the code in a separate thread, async is not the tool for the job. Try with thread pool instead:

    ThreadPool.QueueUserWorkItem( foo => PushCallAsync(callNotificationInfo) );
    

提交回复
热议问题