Create a completed Task

前端 未结 8 1959
名媛妹妹
名媛妹妹 2020-11-28 06:13

I want to create a completed Task (not Task). Is there something built into .NET to do this?

A related question: Create a complete

8条回答
  •  伪装坚强ぢ
    2020-11-28 07:00

    How about:

    #pragma warning disable 1998
        public async Task emptyTask() {
        }
    #pragma warning restore 1998
    

    You can leave out the warning suppression if you don't mind it.

提交回复
热议问题