From 0c5827c48034bfb102215b6710e8f6fdf1e58a81 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Thu, 14 Mar 2024 21:38:13 +0800 Subject: [PATCH] feat: update ToTask --- src/WeihanLi.Common/Helpers/TaskHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WeihanLi.Common/Helpers/TaskHelper.cs b/src/WeihanLi.Common/Helpers/TaskHelper.cs index 529de7c8..65fda6ae 100644 --- a/src/WeihanLi.Common/Helpers/TaskHelper.cs +++ b/src/WeihanLi.Common/Helpers/TaskHelper.cs @@ -24,6 +24,7 @@ public static Task ToTask(object? obj, T defaultValue = default) Task t => t, ValueTask vt0 => vt0.AsTask().ContinueWith(_ => defaultValue), Task t0 => t0.ContinueWith(_ => defaultValue), + T v => Task.FromResult(v), _ => Task.FromResult(defaultValue) }; return task;