Permalink
Browse files

TaskSample - remove result from MatchFunc task (unnecessary/unused)

  • Loading branch information...
bobbymcr committed May 23, 2018
1 parent 647a970 commit cb81d9b9457951e7ee5ddad396d68cb11bf66c36
Showing with 4 additions and 7 deletions.
  1. +4 −7 projects/TaskSample/TaskSample.Core/Extensions/FuncTaskExtensions.cs
@@ -13,7 +13,7 @@ public static class FuncTaskExtensions
{
public static async Task<T> FirstAsync<T>(this IEnumerable<Func<CancellationToken, Task<T>>> funcs, Predicate<T> pred)
{
var tasks = new List<Task<T>>();
var tasks = new List<Task>();
using (MatchFunc<T> match = new MatchFunc<T>(pred))
{
foreach (Func<CancellationToken, Task<T>> func in funcs)
@@ -23,7 +23,7 @@ public static async Task<T> FirstAsync<T>(this IEnumerable<Func<CancellationToke
break;
}
Task<T> task = match.RunAsync(func);
Task task = match.RunAsync(func);
tasks.Add(task);
}
@@ -60,12 +60,11 @@ public T Result
}
}
public async Task<T> RunAsync(Func<CancellationToken, Task<T>> func)
public async Task RunAsync(Func<CancellationToken, Task<T>> func)
{
T result = default(T);
try
{
result = await func(this.cts.Token);
T result = await func(this.cts.Token);
if (this.pred(result))
{
this.firstResult = Tuple.Create(result);
@@ -75,8 +74,6 @@ public async Task<T> RunAsync(Func<CancellationToken, Task<T>> func)
catch (Exception)
{
}
return result;
}
public void Dispose()

0 comments on commit cb81d9b

Please sign in to comment.