迁移部分方法到 TaskExtensions

This commit is contained in:
龙腾猫跃 committed 2026-06-25 07:30:00 +08:00
1 parent 1a639fa88f
commit 6a6b43fe9a
4 files changed
+13 -6

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ public static class ExceptionExtensions {
/// <summary>
/// 当该异常或其子异常是 <see cref="OperationCanceledException"/>、<see cref="TaskCanceledException"/> 或 <see cref="ThreadInterruptedException"/> 时,抛出对应异常。
/// </summary>
public static void ThrowOnCanceled(this Exception ex) {
public static void ThrowIfCanceled(this Exception ex) {
foreach (var inner in ex.Flatten()) {
if (inner is OperationCanceledException or TaskCanceledException or ThreadInterruptedException) throw inner;
}