/
GeekNerd
/
ServerModelingProject
Обзор
Документация
Войти
/
GeekNerd
/
ServerModelingProject
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Plugins/UniTask/Runtime/Linq/Throw.cs
54 строки
1 KB
Gorney-Alex
Init
30 май 2026, 19:05
30 май 2026, 19:05
3cdcc49
Код
Авторство
О чём код?
using Cysharp.Threading.Tasks.Internal; using System; using System.Threading; namespace Cysharp.Threading.Tasks.Linq { public static partial class UniTaskAsyncEnumerable { public static IUniTaskAsyncEnumerable<TValue> Throw<TValue>(Exception exception) { return new Throw<TValue>(exception); } } internal class Throw<TValue> : IUniTaskAsyncEnumerable<TValue> { readonly Exception exception; public Throw(Exception exception) { this.exception = exception; } public IUniTaskAsyncEnumerator<TValue> GetAsyncEnumerator(CancellationToken cancellationToken = default) { return new _Throw(exception, cancellationToken); } class _Throw : IUniTaskAsyncEnumerator<TValue> { readonly Exception exception; CancellationToken cancellationToken; public _Throw(Exception exception, CancellationToken cancellationToken) { this.exception = exception; this.cancellationToken = cancellationToken; } public TValue Current => default; public UniTask<bool> MoveNextAsync() { cancellationToken.ThrowIfCancellationRequested(); return UniTask.FromException<bool>(exception); } public UniTask DisposeAsync() { return default; } } } }