Skip to content

Commit

Permalink
guard for ForEachAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed May 20, 2020
1 parent e31c87b commit a52c261
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ForEach.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ public static UniTask ForEachAsync<TSource>(this IUniTaskAsyncEnumerable<TSource
return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAsync(source, action, cancellationToken);
}

/// <summary>Obsolete(Error), Use Use ForEachAwaitAsync instead.</summary>
[Obsolete("Use ForEachAwaitAsync instead.", true)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static UniTask ForEachAsync<T>(this IUniTaskAsyncEnumerable<T> source, Func<T, UniTask> action, CancellationToken cancellationToken = default)
{
throw new NotSupportedException("Use ForEachAwaitAsync instead.");
}

/// <summary>Obsolete(Error), Use Use ForEachAwaitAsync instead.</summary>
[Obsolete("Use ForEachAwaitAsync instead.", true)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static UniTask ForEachAsync<T>(this IUniTaskAsyncEnumerable<T> source, Func<T, int, UniTask> action, CancellationToken cancellationToken = default)
{
throw new NotSupportedException("Use ForEachAwaitAsync instead.");
}

public static UniTask ForEachAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> action, CancellationToken cancellationToken = default)
{
Error.ThrowArgumentNullException(source, nameof(source));
Expand Down

0 comments on commit a52c261

Please sign in to comment.