├── .gitattributes ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE.md ├── .gitignore ├── LICENSE ├── README.md ├── dapper-plus-sponsor.png ├── entity-framework-extensions-sponsor.png └── src ├── Z.Linq.Async.NetStandard20 └── Z.Linq.Async.NetStandard20.csproj ├── Z.Linq.Async.Shared ├── EnumerableAsync │ ├── AsyncEnumerable.cs │ ├── AsyncEnumerable`.cs │ ├── AsyncEnumerator.cs │ ├── AsyncEnumerator`.cs │ ├── AsyncOrderedEnumerable`.cs │ ├── AsyncWhereEnumerable`.cs │ ├── EnumerableTask │ │ └── Deferred_EnumerableTask │ │ │ └── IEnumerable` │ │ │ ├── OrderByCompletion.cs │ │ │ └── SelectResult.cs │ ├── LINQ │ │ ├── Deferred_Enumerable │ │ │ ├── IEnumerable │ │ │ │ ├── CastAsync.cs │ │ │ │ └── OfTypeAsync.cs │ │ │ ├── IEnumerable` │ │ │ │ ├── AsEnumerableAsync.cs │ │ │ │ ├── ConcatAsync.cs │ │ │ │ ├── DefaultIfEmptyAsync.cs │ │ │ │ ├── DistinctAsync.cs │ │ │ │ ├── ExceptAsync.cs │ │ │ │ ├── GroupByAsync.cs │ │ │ │ ├── GroupJoinAsync.cs │ │ │ │ ├── IntersectAsync.cs │ │ │ │ ├── JoinAsync.cs │ │ │ │ ├── OrderByAsync.cs │ │ │ │ ├── OrderByDescendingAsync.cs │ │ │ │ ├── ReverseAsync.cs │ │ │ │ ├── SelectAsync.cs │ │ │ │ ├── SelectManyAsync.cs │ │ │ │ ├── SkipAsync.cs │ │ │ │ ├── SkipWhileAsync.cs │ │ │ │ ├── TakeAsync.cs │ │ │ │ ├── TakeWhileAsync.cs │ │ │ │ ├── UnionAsync.cs │ │ │ │ ├── WhereAsync.cs │ │ │ │ └── ZipAsync.cs │ │ │ └── IOrderedEnumerable` │ │ │ │ ├── ThenByAsync.cs │ │ │ │ └── ThenByDescendingAsync.cs │ │ ├── Deferred_Task │ │ │ ├── Array │ │ │ │ ├── AsEnumerable.cs │ │ │ │ ├── Cast.cs │ │ │ │ ├── Concat.cs │ │ │ │ ├── DefaultIfEmpty.cs │ │ │ │ ├── Distinct.cs │ │ │ │ ├── Except.cs │ │ │ │ ├── GroupBy.cs │ │ │ │ ├── GroupJoin.cs │ │ │ │ ├── Intersect.cs │ │ │ │ ├── Join.cs │ │ │ │ ├── OfType.cs │ │ │ │ ├── OrderBy.cs │ │ │ │ ├── OrderByDescending.cs │ │ │ │ ├── Reverse.cs │ │ │ │ ├── Select.cs │ │ │ │ ├── SelectMany.cs │ │ │ │ ├── Skip.cs │ │ │ │ ├── SkipWhile.cs │ │ │ │ ├── Take.cs │ │ │ │ ├── TakeWhile.cs │ │ │ │ ├── Union.cs │ │ │ │ ├── Where.cs │ │ │ │ └── Zip.cs │ │ │ ├── AsyncWhereEnumerable` │ │ │ │ ├── AsEnumerable.cs │ │ │ │ ├── Cast.cs │ │ │ │ ├── Concat.cs │ │ │ │ ├── DefaultIfEmpty.cs │ │ │ │ ├── Distinct.cs │ │ │ │ ├── Except.cs │ │ │ │ ├── GroupBy.cs │ │ │ │ ├── GroupJoin.cs │ │ │ │ ├── Intersect.cs │ │ │ │ ├── Join.cs │ │ │ │ ├── OfType.cs │ │ │ │ ├── OrderBy.cs │ │ │ │ ├── OrderByDescending.cs │ │ │ │ ├── Reverse.cs │ │ │ │ ├── Select.cs │ │ │ │ ├── SelectMany.cs │ │ │ │ ├── Skip.cs │ │ │ │ ├── SkipWhile.cs │ │ │ │ ├── Take.cs │ │ │ │ ├── TakeWhile.cs │ │ │ │ ├── Union.cs │ │ │ │ ├── Where.cs │ │ │ │ └── Zip.cs │ │ │ ├── Collection` │ │ │ │ └── AsEnumerable.cs │ │ │ ├── Dictionary`2 │ │ │ │ └── AsEnumerable.cs │ │ │ ├── ICollection` │ │ │ │ └── AsEnumerable.cs │ │ │ ├── IDictionary`2 │ │ │ │ └── AsEnumerable.cs │ │ │ ├── IEnumerable │ │ │ │ ├── Cast.cs │ │ │ │ └── OfType.cs │ │ │ ├── IEnumerable` │ │ │ │ ├── AsEnumerable.cs │ │ │ │ ├── Concat.cs │ │ │ │ ├── DefaultIfEmpty.cs │ │ │ │ ├── Distinct.cs │ │ │ │ ├── Except.cs │ │ │ │ ├── GroupBy.cs │ │ │ │ ├── GroupJoin.cs │ │ │ │ ├── Intersect.cs │ │ │ │ ├── Join.cs │ │ │ │ ├── OrderBy.cs │ │ │ │ ├── OrderByDescending.cs │ │ │ │ ├── Reverse.cs │ │ │ │ ├── Select.cs │ │ │ │ ├── SelectMany.cs │ │ │ │ ├── Skip.cs │ │ │ │ ├── SkipWhile.cs │ │ │ │ ├── Take.cs │ │ │ │ ├── TakeWhile.cs │ │ │ │ ├── ThenBy.cs │ │ │ │ ├── ThenByDescending.cs │ │ │ │ ├── Union.cs │ │ │ │ ├── Where.cs │ │ │ │ └── Zip.cs │ │ │ ├── IList` │ │ │ │ └── AsEnumerable.cs │ │ │ ├── ILookup`2 │ │ │ │ └── AsEnumerable.cs │ │ │ ├── IOrderedEnumerable` │ │ │ │ ├── AsEnumerable.cs │ │ │ │ ├── Cast.cs │ │ │ │ ├── Concat.cs │ │ │ │ ├── DefaultIfEmpty.cs │ │ │ │ ├── Distinct.cs │ │ │ │ ├── Except.cs │ │ │ │ ├── GroupBy.cs │ │ │ │ ├── GroupJoin.cs │ │ │ │ ├── Intersect.cs │ │ │ │ ├── Join.cs │ │ │ │ ├── OfType.cs │ │ │ │ ├── OrderBy.cs │ │ │ │ ├── OrderByDescending.cs │ │ │ │ ├── Reverse.cs │ │ │ │ ├── Select.cs │ │ │ │ ├── SelectMany.cs │ │ │ │ ├── Skip.cs │ │ │ │ ├── SkipWhile.cs │ │ │ │ ├── Take.cs │ │ │ │ ├── TakeWhile.cs │ │ │ │ ├── Union.cs │ │ │ │ ├── Where.cs │ │ │ │ └── Zip.cs │ │ │ ├── IReadOnlyCollection` │ │ │ │ └── AsEnumerable.cs │ │ │ ├── IReadOnlyDictionary`2 │ │ │ │ └── AsEnumerable.cs │ │ │ ├── IReadOnlyList` │ │ │ │ └── AsEnumerable.cs │ │ │ ├── List` │ │ │ │ ├── AsEnumerable.cs │ │ │ │ ├── Cast.cs │ │ │ │ ├── Concat.cs │ │ │ │ ├── DefaultIfEmpty.cs │ │ │ │ ├── Distinct.cs │ │ │ │ ├── Except.cs │ │ │ │ ├── GroupBy.cs │ │ │ │ ├── GroupJoin.cs │ │ │ │ ├── Intersect.cs │ │ │ │ ├── Join.cs │ │ │ │ ├── OfType.cs │ │ │ │ ├── OrderBy.cs │ │ │ │ ├── OrderByDescending.cs │ │ │ │ ├── Reverse.cs │ │ │ │ ├── Select.cs │ │ │ │ ├── SelectMany.cs │ │ │ │ ├── Skip.cs │ │ │ │ ├── SkipWhile.cs │ │ │ │ ├── Take.cs │ │ │ │ ├── TakeWhile.cs │ │ │ │ ├── Union.cs │ │ │ │ ├── Where.cs │ │ │ │ └── Zip.cs │ │ │ ├── Lookup`2 │ │ │ │ └── AsEnumerable.cs │ │ │ └── ReadOnlyCollection` │ │ │ │ └── AsEnumerable.cs │ │ ├── Immediate_Enumerable │ │ │ └── IEnumerable` │ │ │ │ ├── AggregateAsync.cs │ │ │ │ ├── AllAsync.cs │ │ │ │ ├── AnyAsync.cs │ │ │ │ ├── AverageAsync.cs │ │ │ │ ├── ContainsAsync.cs │ │ │ │ ├── CountAsync.cs │ │ │ │ ├── ElementAtAsync.cs │ │ │ │ ├── ElementAtOrDefaultAsync.cs │ │ │ │ ├── FirstAsync.cs │ │ │ │ ├── FirstOrDefaultAsync.cs │ │ │ │ ├── LastAsync.cs │ │ │ │ ├── LastOrDefaultAsync.cs │ │ │ │ ├── LongCountAsync.cs │ │ │ │ ├── MaxAsync.cs │ │ │ │ ├── MinAsync.cs │ │ │ │ ├── SequenceEqualAsync.cs │ │ │ │ ├── SingleAsync.cs │ │ │ │ ├── SingleOrDefaultAsync.cs │ │ │ │ ├── SumAsync.cs │ │ │ │ ├── ToArrayAsync.cs │ │ │ │ ├── ToDictionaryAsync.cs │ │ │ │ ├── ToListAsync.cs │ │ │ │ └── ToLookupAsync.cs │ │ └── Immediate_Task │ │ │ ├── Array │ │ │ ├── Aggregate.cs │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Average.cs │ │ │ ├── Contains.cs │ │ │ ├── Count.cs │ │ │ ├── ElementAt.cs │ │ │ ├── ElementAtOrDefault.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Max.cs │ │ │ ├── Min.cs │ │ │ ├── SequenceEqual.cs │ │ │ ├── Single.cs │ │ │ ├── SingleOrDefault.cs │ │ │ ├── Sum.cs │ │ │ ├── ToArray.cs │ │ │ ├── ToDictionary.cs │ │ │ ├── ToList.cs │ │ │ └── ToLookup.cs │ │ │ ├── AsyncWhereEnumerable` │ │ │ ├── Aggregate.cs │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Average.cs │ │ │ ├── Contains.cs │ │ │ ├── Count.cs │ │ │ ├── ElementAt.cs │ │ │ ├── ElementAtOrDefault.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Max.cs │ │ │ ├── Min.cs │ │ │ ├── SequenceEqual.cs │ │ │ ├── Single.cs │ │ │ ├── SingleOrDefault.cs │ │ │ ├── Sum.cs │ │ │ ├── ToArray.cs │ │ │ ├── ToDictionary.cs │ │ │ ├── ToList.cs │ │ │ └── ToLookup.cs │ │ │ ├── IEnumerable` │ │ │ ├── Aggregate.cs │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Average.cs │ │ │ ├── Contains.cs │ │ │ ├── Count.cs │ │ │ ├── ElementAt.cs │ │ │ ├── ElementAtOrDefault.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Max.cs │ │ │ ├── Min.cs │ │ │ ├── SequenceEqual.cs │ │ │ ├── Single.cs │ │ │ ├── SingleOrDefault.cs │ │ │ ├── Sum.cs │ │ │ ├── ToArray.cs │ │ │ ├── ToDictionary.cs │ │ │ ├── ToList.cs │ │ │ └── ToLookup.cs │ │ │ ├── IOrderedEnumerable` │ │ │ ├── Aggregate.cs │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Average.cs │ │ │ ├── Contains.cs │ │ │ ├── Count.cs │ │ │ ├── ElementAt.cs │ │ │ ├── ElementAtOrDefault.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Max.cs │ │ │ ├── Min.cs │ │ │ ├── SequenceEqual.cs │ │ │ ├── Single.cs │ │ │ ├── SingleOrDefault.cs │ │ │ ├── Sum.cs │ │ │ ├── ToArray.cs │ │ │ ├── ToDictionary.cs │ │ │ ├── ToList.cs │ │ │ └── ToLookup.cs │ │ │ └── List` │ │ │ ├── Aggregate.cs │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Average.cs │ │ │ ├── Contains.cs │ │ │ ├── Count.cs │ │ │ ├── ElementAt.cs │ │ │ ├── ElementAtOrDefault.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Max.cs │ │ │ ├── Min.cs │ │ │ ├── SequenceEqual.cs │ │ │ ├── Single.cs │ │ │ ├── SingleOrDefault.cs │ │ │ ├── Sum.cs │ │ │ ├── ToArray.cs │ │ │ ├── ToDictionary.cs │ │ │ ├── ToList.cs │ │ │ └── ToLookup.cs │ ├── PredicateAsync │ │ ├── Deferred_Enumerable_AsyncFunc │ │ │ └── IEnumerable` │ │ │ │ ├── SkipWhileAsync.cs │ │ │ │ └── WhereAsync.cs │ │ ├── Deferred_Task_AsyncFunc │ │ │ ├── Array │ │ │ │ ├── SkipWhile.cs │ │ │ │ └── Where.cs │ │ │ ├── AsyncWhereEnumerable` │ │ │ │ ├── SkipWhile.cs │ │ │ │ └── Where.cs │ │ │ ├── IEnumerable` │ │ │ │ ├── SkipWhile.cs │ │ │ │ └── Where.cs │ │ │ ├── IOrderedEnumerable` │ │ │ │ ├── SkipWhile.cs │ │ │ │ └── Where.cs │ │ │ └── List` │ │ │ │ ├── SkipWhile.cs │ │ │ │ └── Where.cs │ │ ├── Immediate_Enumerable_AsyncFunc │ │ │ └── IEnumerable` │ │ │ │ ├── AllAsync.cs │ │ │ │ ├── AnyAsync.cs │ │ │ │ ├── CountAsync.cs │ │ │ │ ├── FirstAsync.cs │ │ │ │ ├── FirstOrDefaultAsync.cs │ │ │ │ ├── LastAsync.cs │ │ │ │ ├── LastOrDefaultAsync.cs │ │ │ │ ├── LongCountAsync.cs │ │ │ │ ├── SingleAsync.cs │ │ │ │ └── SingleOrDefaultAsync.cs │ │ └── Immediate_Task_AsyncFunc │ │ │ ├── Array │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Count.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Single.cs │ │ │ └── SingleOrDefault.cs │ │ │ ├── IEnumerable` │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Count.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Single.cs │ │ │ └── SingleOrDefault.cs │ │ │ ├── IOrderedEnumerable` │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Count.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Single.cs │ │ │ └── SingleOrDefault.cs │ │ │ ├── List` │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Count.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Single.cs │ │ │ └── SingleOrDefault.cs │ │ │ └── `AsyncWhereEnumerable │ │ │ ├── All.cs │ │ │ ├── Any.cs │ │ │ ├── Count.cs │ │ │ ├── First.cs │ │ │ ├── FirstOrDefault.cs │ │ │ ├── Last.cs │ │ │ ├── LastOrDefault.cs │ │ │ ├── LongCount.cs │ │ │ ├── Single.cs │ │ │ └── SingleOrDefault.cs │ ├── TaskFactory │ │ ├── Array │ │ │ └── FromTaskEnumerable.cs │ │ ├── AsyncWhereEnumerable` │ │ │ └── FromTaskEnumerable.cs │ │ ├── Collection` │ │ │ └── FromTaskEnumerable.cs │ │ ├── Dictionary`2 │ │ │ └── FromTaskEnumerable.cs │ │ ├── FromEnumerableAsync.cs │ │ ├── ICollection` │ │ │ └── FromTaskEnumerable.cs │ │ ├── IDictionary`2 │ │ │ └── FromTaskEnumerable.cs │ │ ├── IEnumerable │ │ │ └── FromTaskEnumerable.cs │ │ ├── IEnumerable` │ │ │ ├── FromEnumerable.cs │ │ │ ├── FromTaskEnumerable.cs │ │ │ ├── FromWhereEnumerable.cs │ │ │ └── FromWhereTaskEnumerable.cs │ │ ├── IList` │ │ │ └── FromTaskEnumerable.cs │ │ ├── ILookup`2 │ │ │ └── FromTaskEnumerable.cs │ │ ├── IOrdoredEnumerable` │ │ │ ├── FromEnumerable.cs │ │ │ └── FromTaskEnumerable.cs │ │ ├── IReadOnlyCollection` │ │ │ └── FromTaskEnumerable.cs │ │ ├── IReadOnlyDictionary`2 │ │ │ └── FromTaskEnumerable.cs │ │ ├── IReadOnlyList` │ │ │ └── FromTaskEnumerable.cs │ │ ├── List │ │ │ └── FromTaskEnumerable.cs │ │ ├── Lookup`2 │ │ │ └── FromTaskEnumerable.cs │ │ └── ReadOnlyCollection` │ │ │ └── FromTaskEnumerable.cs │ └── WhereAsyncEnumerable` │ │ ├── OrderByPredicateCompletion.cs │ │ └── StartPredicateConcurrently.cs ├── LinqAsyncManager.cs ├── Z.Linq.Async.Shared.projitems └── Z.Linq.Async.Shared.shproj ├── Z.Linq.Async.sln ├── Z.Linq.Async ├── Properties │ └── AssemblyInfo.cs ├── Z.Linq.Async.csproj └── Z.Linq.Async.csproj.vspscc ├── lab └── Z.Lab.LinqAsync.NetCore │ ├── Program.cs │ ├── Z.Lab.LinqAsync.NetCore.csproj │ └── _Model │ ├── TestEnumerable.cs │ ├── TestEnumerableAsync.cs │ ├── TestEnumerator.cs │ ├── TestEnumeratorAsync.cs │ ├── TestPredicate.cs │ └── TestPredicateAsync.cs └── test └── Z.Test.Linq.Async ├── ExceptionHandling.cs ├── ExceptionHandling ├── PredicateAsyncConcurrentlyError.cs ├── PredicateAsyncConcurrently_Enumerable_PredicateAsyncError.cs ├── PredicateAsyncConcurrently_ToList_PredicateAsyncError.cs ├── PredicateAsyncError.cs ├── PredicateAsync_Enumerable_PredicateAsyncError.cs ├── PredicateAsync_ToList_PredicateAsyncError.cs ├── PredicateError.cs ├── Predicate_Enumerable_PredicateError.cs ├── Predicate_ToList_PredicateError.cs └── ToListError.cs ├── OrderByCompletion.cs ├── OrderByCompletion └── IsOrdered.cs ├── OrderByPredicateCompletion.cs ├── OrderByPredicateCompletion ├── IsFalse_Default.cs ├── IsTrue.cs ├── Manager_IsFalse.cs ├── Manager_IsFalse_Order_IsFalse.cs ├── Manager_IsFalse_Order_IsTrue.cs ├── Manager_IsTrue.cs ├── Manager_IsTrue_Order_IsFalse.cs └── Manager_IsTrue_Order_IsTrue.cs ├── PredicateAsync_StartConcurrentlyAndOrderByCompletion.cs ├── PredicateAsync_StartConcurrentlyAndOrderByCompletion ├── IsFalse_IsFalse_Default.cs ├── IsFalse_IsTrue.cs ├── IsTrue_IsFalse.cs └── IsTrue_IsTrue.cs ├── Properties └── AssemblyInfo.cs ├── SelectResult.cs ├── SelectResult ├── IsOrdered.cs └── OrderByCompletion_IsOrdered.cs ├── StartPredicateConcurrently.cs ├── StartPredicateConcurrently ├── IsFalse_Default.cs ├── IsTrue.cs ├── Manager_IsFalse.cs ├── Manager_IsFalse_Order_IsFalse.cs ├── Manager_IsFalse_Order_IsTrue.cs ├── Manager_IsTrue.cs ├── Manager_IsTrue_Order_IsFalse.cs └── Manager_IsTrue_Order_IsTrue.cs ├── Z.Test.Linq.Async.csproj ├── Z.Test.Linq.Async.csproj.vspscc └── _Model ├── TestEnumerable.cs ├── TestEnumerableAsync.cs ├── TestEnumerator.cs ├── TestEnumeratorAsync.cs ├── TestPredicate.cs └── TestPredicateAsync.cs /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | 2 | github: [zzzprojects, Linq-Async] 3 | custom: ["https://zzzprojects.com/contribute"] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Here is what to include in your request to make sure we implement a solution as quickly as possible. 2 | 3 | ## 1. Description 4 | Describe the issue or propose a feature. 5 | 6 | ## 2. Exception 7 | If you are seeing an exception, include the full exception details (message and stack trace). 8 | 9 | ``` 10 | Exception message: 11 | Stack trace: 12 | ``` 13 | 14 | ## 3. Fiddle or Project 15 | If you are able, 16 | 17 | Provide a Fiddle that reproduce the issue: https://dotnetfiddle.net/25Vjsn 18 | 19 | Or provide a project/solution that we can run to reproduce the issue. 20 | - Make sure the project compile 21 | - Make sure to provide only the code that is required to reproduce the issue, not the whole project 22 | - You can send private code here: info@zzzprojects.com 23 | 24 | Otherwise, make sure to include as much information as possible to help our team to reproduce the issue. 25 | 26 | ## 4. Any further technical details 27 | Add any relevant detail that can help us. 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Bb]in/ 2 | [Oo]bj/ 3 | [Pp]ackages/ 4 | Z.Lab/ 5 | *.suo 6 | *.user 7 | *.userprefs 8 | _ReSharper.* 9 | *.ReSharper.user 10 | *.resharper.user 11 | *.pfx 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © ZZZ Projects Inc. 2014 - 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dapper-plus-sponsor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzzprojects/LINQ-Async/59a43e460cffdc100ea246cec0b894146af8df5b/dapper-plus-sponsor.png -------------------------------------------------------------------------------- /entity-framework-extensions-sponsor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzzprojects/LINQ-Async/59a43e460cffdc100ea246cec0b894146af8df5b/entity-framework-extensions-sponsor.png -------------------------------------------------------------------------------- /src/Z.Linq.Async.NetStandard20/Z.Linq.Async.NetStandard20.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | Z.Linq.Async 6 | 1.0.3 7 | ZZZ Projects 8 | Z.Linq.Async 9 | C# LINQ Async extension methods library for async/await task. 10 | ZZZ Projects 11 | https://github.com/zzzprojects/LINQ-Async/blob/master/LICENSE 12 | true 13 | zzzproject.pfx 14 | Z.Linq.Async 15 | Z.Linq.Async 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/EnumerableTask/Deferred_EnumerableTask/IEnumerable`/SelectResult.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> SelectResult(this IEnumerable> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.FromResult(source.Select(x => x.Result)); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable/CastAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> CastAsync(this IEnumerable source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Cast, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable/OfTypeAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> OfTypeAsync(this IEnumerable source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.OfType, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable`/AsEnumerableAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerableAsync(this IEnumerable source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable`/ConcatAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ConcatAsync(this IEnumerable first, IEnumerable second, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(first, second, Enumerable.Concat, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable`/ReverseAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ReverseAsync(this IEnumerable source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, Enumerable.Reverse, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable`/SkipAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> SkipAsync(this IEnumerable source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, count, Enumerable.Skip, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable`/TakeAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> TakeAsync(this IEnumerable source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, count, Enumerable.Take, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Enumerable/IEnumerable`/ZipAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> ZipAsync(this IEnumerable first, IEnumerable second, Func resultSelector, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(first, second, resultSelector, Enumerable.Zip, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/Cast.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Cast(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Cast, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/Concat.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Concat(this Task first, IEnumerable second, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(first, second, Enumerable.Concat, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/OfType.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> OfType(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.OfType, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/Reverse.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Reverse(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Reverse, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/Skip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Skip(this Task source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Skip, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/Take.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Take(this Task source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Take, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Array/Zip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Zip(this Task first, IEnumerable second, Func resultSelector, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(first, second, resultSelector, Enumerable.Zip, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/Cast.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Cast(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Cast, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/Concat.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Concat(this Task> first, IEnumerable second, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(first, second, Enumerable.Concat, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/OfType.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> OfType(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.OfType, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/Reverse.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Reverse(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Reverse, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/Skip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Skip(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Skip, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/Take.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Take(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Take, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/AsyncWhereEnumerable`/Zip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | using Z.Linq.Async; 14 | 15 | namespace Z.Linq 16 | { 17 | public static partial class EnumerableAsync 18 | { 19 | public static Task> Zip(this Task> first, IEnumerable second, Func resultSelector, CancellationToken cancellationToken = default(CancellationToken)) 20 | { 21 | return Task.Factory.FromTaskEnumerable(first, second, resultSelector, Enumerable.Zip, cancellationToken); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Collection`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Collections.ObjectModel; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Dictionary`2/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task>> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/ICollection`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IDictionary`2/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task>> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable/Cast.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Cast(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Cast, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable/OfType.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> OfType(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.OfType, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable`/Concat.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Concat(this Task> first, IEnumerable second, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(first, second, Enumerable.Concat, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable`/Reverse.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Reverse(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Reverse, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable`/Skip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Skip(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Skip, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable`/Take.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Take(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Take, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IEnumerable`/Zip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Zip(this Task> first, IEnumerable second, Func resultSelector, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(first, second, resultSelector, Enumerable.Zip, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IList`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/ILookup`2/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task>> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/Cast.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Cast(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Cast, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/Concat.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Concat(this Task> first, IEnumerable second, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(first, second, Enumerable.Concat, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/OfType.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> OfType(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.OfType, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/Reverse.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Reverse(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Reverse, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/Skip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Skip(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Skip, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/Take.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Take(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Take, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IOrderedEnumerable`/Zip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Zip(this Task> first, IEnumerable second, Func resultSelector, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(first, second, resultSelector, Enumerable.Zip, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IReadOnlyCollection`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IReadOnlyDictionary`2/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task>> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/IReadOnlyList`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/Cast.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Cast(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Cast, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/Concat.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Concat(this Task> first, IEnumerable second, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(first, second, Enumerable.Concat, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/OfType.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> OfType(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.OfType, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/Reverse.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Reverse(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Reverse, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/Skip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Skip(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Skip, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/Take.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> Take(this Task> source, int count, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, count, Enumerable.Take, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/List`/Zip.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> Zip(this Task> first, IEnumerable second, Func resultSelector, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(first, second, resultSelector, Enumerable.Zip, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/Lookup`2/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task>> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Deferred_Task/ReadOnlyCollection`/AsEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Collections.ObjectModel; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> AsEnumerable(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.AsEnumerable, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Enumerable/IEnumerable`/AllAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task AllAsync(this IEnumerable source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.All, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Enumerable/IEnumerable`/ElementAtAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAtAsync(this IEnumerable source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, index, Enumerable.ElementAt, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Enumerable/IEnumerable`/ElementAtOrDefaultAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAtOrDefaultAsync(this IEnumerable source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, index, Enumerable.ElementAtOrDefault, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Enumerable/IEnumerable`/ToArrayAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ToArrayAsync(this IEnumerable source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, Enumerable.ToArray, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Enumerable/IEnumerable`/ToListAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ToListAsync(this IEnumerable source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromEnumerable(source, Enumerable.ToList, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task All(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.All, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Any(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Any, cancellationToken); 20 | } 21 | 22 | public static Task Any(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Any, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Count(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Count, cancellationToken); 20 | } 21 | 22 | public static Task Count(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Count, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/ElementAt.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task ElementAt(this Task source, int index, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAt, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/ElementAtOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task ElementAtOrDefault(this Task source, int index, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAtOrDefault, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/First.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task First(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.First, cancellationToken); 20 | } 21 | 22 | public static Task First(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.First, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/Last.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Last(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Last, cancellationToken); 20 | } 21 | 22 | public static Task Last(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Last, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/LastOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LastOrDefault(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.LastOrDefault, cancellationToken); 20 | } 21 | 22 | public static Task LastOrDefault(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.LastOrDefault, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/LongCount.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LongCount(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.LongCount, cancellationToken); 20 | } 21 | 22 | public static Task LongCount(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.LongCount, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/Single.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Single(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Single, cancellationToken); 20 | } 21 | 22 | public static Task Single(this Task source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Single, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/ToArray.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task ToArray(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToArray, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/Array/ToList.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ToList(this Task source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToList, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/AsyncWhereEnumerable`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task All(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.All, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/AsyncWhereEnumerable`/ElementAt.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAt(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAt, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/AsyncWhereEnumerable`/ElementAtOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAtOrDefault(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAtOrDefault, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/AsyncWhereEnumerable`/ToArray.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ToArray(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToArray, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/AsyncWhereEnumerable`/ToList.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Z.Linq.Async; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task> ToList(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToList, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IEnumerable`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task All(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.All, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IEnumerable`/ElementAt.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAt(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAt, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IEnumerable`/ElementAtOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAtOrDefault(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAtOrDefault, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IEnumerable`/ToArray.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ToArray(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToArray, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IEnumerable`/ToList.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ToList(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToList, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IOrderedEnumerable`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task All(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.All, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IOrderedEnumerable`/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Any(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Any, cancellationToken); 20 | } 21 | 22 | public static Task Any(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 23 | { 24 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Any, cancellationToken); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IOrderedEnumerable`/ElementAt.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task ElementAt(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAt, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IOrderedEnumerable`/ElementAtOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task ElementAtOrDefault(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAtOrDefault, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IOrderedEnumerable`/ToArray.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Linq; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task ToArray(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToArray, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/IOrderedEnumerable`/ToList.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ToList(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToList, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task All(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.All, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task Any(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Any, cancellationToken); 21 | } 22 | 23 | public static Task Any(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 24 | { 25 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Any, cancellationToken); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task Count(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, Enumerable.Count, cancellationToken); 21 | } 22 | 23 | public static Task Count(this Task> source, Func predicate, CancellationToken cancellationToken = default(CancellationToken)) 24 | { 25 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Count, cancellationToken); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/ElementAt.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAt(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAt, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/ElementAtOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ElementAtOrDefault(this Task> source, int index, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, index, Enumerable.ElementAtOrDefault, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/ToArray.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task ToArray(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToArray, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/LINQ/Immediate_Task/List`/ToList.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task> ToList(this Task> source, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return Task.Factory.FromTaskEnumerable(source, Enumerable.ToList, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/AllAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task AllAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.All, true, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/AnyAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task AnyAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.Any, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/CountAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task CountAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.Count, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/FirstAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task FirstAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.First, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/FirstOrDefaultAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task FirstOrDefaultAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.FirstOrDefault, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/LastAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task LastAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.Last, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/LastOrDefaultAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task LastOrDefaultAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.LastOrDefault, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/LongCountAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task LongCountAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.LongCount, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/SingleAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task SingleAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.Single, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Enumerable_AsyncFunc/IEnumerable`/SingleOrDefaultAsync.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task SingleOrDefaultAsync(this IEnumerable source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromEnumerable(source, predicate, Enumerable.SingleOrDefault, false, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task All(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).All(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task Any(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).Any(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task Count(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).Count(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/First.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task First(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).First(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/FirstOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task FirstOrDefault(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).FirstOrDefault(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/Last.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task Last(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).Last(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/LastOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task LastOrDefault(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).LastOrDefault(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/LongCount.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task LongCount(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).LongCount(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/Single.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task Single(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).Single(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/Array/SingleOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task SingleOrDefault(this Task source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | return source.AsEnumerable(cancellationToken).SingleOrDefault(predicate, cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task All(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.All, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task Any(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Any, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task Count(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Count, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/First.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task First(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.First, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/FirstOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task FirstOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.FirstOrDefault, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/Last.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task Last(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Last, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/LastOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task LastOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.LastOrDefault, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/LongCount.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task LongCount(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.LongCount, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/Single.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task Single(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.Single, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IEnumerable`/SingleOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class EnumerableAsync 17 | { 18 | public static Task SingleOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return Task.Factory.FromTaskEnumerable(source, predicate, Enumerable.SingleOrDefault, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task All(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).All(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Any(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Any(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Count(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Count(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/First.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task First(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).First(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/FirstOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task FirstOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).FirstOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/Last.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Last(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Last(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/LastOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LastOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).LastOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/LongCount.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LongCount(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).LongCount(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/Single.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Single(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Single(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/IOrderedEnumerable`/SingleOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task SingleOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).SingleOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task All(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).All(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Any(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Any(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Count(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Count(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/First.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task First(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).First(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/FirstOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task FirstOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).FirstOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/Last.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Last(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Last(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/LastOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LastOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).LastOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/LongCount.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LongCount(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).LongCount(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/Single.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Single(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Single(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/List`/SingleOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task SingleOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).SingleOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/All.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task All(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).All(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/Any.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Any(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Any(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/Count.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Count(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Count(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/First.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task First(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).First(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/FirstOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task FirstOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).FirstOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/Last.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Last(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Last(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/LastOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LastOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).LastOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/LongCount.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task LongCount(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).LongCount(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/Single.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task Single(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).Single(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/PredicateAsync/Immediate_Task_AsyncFunc/`AsyncWhereEnumerable/SingleOrDefault.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using Z.Linq.Async; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class EnumerableAsync 16 | { 17 | public static Task SingleOrDefault(this Task> source, Func> predicate, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return source.AsEnumerable(cancellationToken).SingleOrDefault(predicate, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/Collection`/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Collections.ObjectModel; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class TaskFactoryExtensions 17 | { 18 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable.CreateFrom, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/Dictionary`2/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func>, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable>.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/ICollection`/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/IDictionary`2/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func>, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable>.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/IList`/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/ILookup`2/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class TaskFactoryExtensions 17 | { 18 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func>, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable>.CreateFrom, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/IReadOnlyCollection`/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/IReadOnlyDictionary`2/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func>, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable>.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/IReadOnlyList`/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace Z.Linq 14 | { 15 | public static partial class TaskFactoryExtensions 16 | { 17 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 18 | { 19 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable.CreateFrom, cancellationToken); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/Lookup`2/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class TaskFactoryExtensions 17 | { 18 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func>, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable>.CreateFrom, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/TaskFactory/ReadOnlyCollection`/FromTaskEnumerable.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Collections.ObjectModel; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace Z.Linq 15 | { 16 | public static partial class TaskFactoryExtensions 17 | { 18 | public static Task FromTaskEnumerable(this TaskFactory taskFactory, Task> task, Func, TResult> func, CancellationToken cancellationToken = default(CancellationToken)) 19 | { 20 | return FromTaskEnumerable(taskFactory, task, func, AsyncEnumerable.CreateFrom, cancellationToken); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/WhereAsyncEnumerable`/OrderByPredicateCompletion.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | using Z.Linq.Async; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task> OrderByPredicateCompletion(this Task> source, bool value = true, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | var sourceState = (AsyncWhereEnumerable) source.AsyncState; 19 | sourceState.OrderByPredicateCompletion = value; 20 | return source; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/EnumerableAsync/WhereAsyncEnumerable`/StartPredicateConcurrently.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | using Z.Linq.Async; 11 | 12 | namespace Z.Linq 13 | { 14 | public static partial class EnumerableAsync 15 | { 16 | public static Task> StartPredicateConcurrently(this Task> source, bool value = true, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | var sourceState = (AsyncWhereEnumerable) source.AsyncState; 19 | sourceState.StartPredicateConcurrently = value; 20 | return source; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/LinqAsyncManager.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | namespace Z.Linq.Async 9 | { 10 | public static class LinqAsyncManager 11 | { 12 | static LinqAsyncManager() 13 | { 14 | DefaultValue.OrderByPredicateCompletion = false; 15 | DefaultValue.StartPredicateConcurrently = false; 16 | } 17 | 18 | public static class DefaultValue 19 | { 20 | public static bool OrderByPredicateCompletion { get; set; } 21 | public static bool StartPredicateConcurrently { get; set; } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Z.Linq.Async.Shared/Z.Linq.Async.Shared.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9e4cc057-6a64-4a8b-8e65-65eae53488bf 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Z.Linq.Async/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Description: Async extension methods for LINQ (Language Integrated Query). 2 | // Website & Documentation: https://github.com/zzzprojects/LINQ-Async 3 | // Forum: https://github.com/zzzprojects/LINQ-Async/issues 4 | // License: http://www.zzzprojects.com/license-agreement/ 5 | // More projects: http://www.zzzprojects.com/ 6 | // Copyright (c) 2015 ZZZ Projects. All rights reserved. 7 | 8 | using System.Reflection; 9 | using System.Runtime.InteropServices; 10 | 11 | [assembly: AssemblyTitle("Z.Linq.Async")] 12 | [assembly: AssemblyDescription("C# LINQ Async extension methods library for async/await task.")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("ZZZ Projects Inc.")] 15 | [assembly: AssemblyProduct("Z.Linq.Async")] 16 | [assembly: AssemblyCopyright("Copyright © ZZZ Projects Inc.")] 17 | [assembly: AssemblyTrademark("SQL & .NET Tools")] 18 | [assembly: AssemblyCulture("")] 19 | [assembly: ComVisible(false)] 20 | [assembly: AssemblyVersion("1.0.3")] 21 | [assembly: AssemblyFileVersion("1.0.3")] -------------------------------------------------------------------------------- /src/Z.Linq.Async/Z.Linq.Async.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /src/lab/Z.Lab.LinqAsync.NetCore/Z.Lab.LinqAsync.NetCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/lab/Z.Lab.LinqAsync.NetCore/_Model/TestEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Z.Test.Linq.Async.Model; 5 | 6 | namespace Z.Test.Linq.Async 7 | { 8 | public class TestEnumerable : IEnumerable 9 | { 10 | public TestEnumerable(List originalValues) 11 | { 12 | CurrentIndex = -1; 13 | OriginalValues = originalValues; 14 | } 15 | 16 | public TestEnumerable(List originalValues, Func errorPredicate) 17 | { 18 | CurrentIndex = -1; 19 | ErrorPredicate = errorPredicate; 20 | OriginalValues = originalValues; 21 | } 22 | 23 | public List OriginalValues { get; set; } 24 | 25 | public int CurrentIndex { get; set; } 26 | 27 | public Func ErrorPredicate { get; set; } 28 | 29 | public IEnumerator GetEnumerator() 30 | { 31 | return new TestEnumerator(this); 32 | } 33 | 34 | IEnumerator IEnumerable.GetEnumerator() 35 | { 36 | return GetEnumerator(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/lab/Z.Lab.LinqAsync.NetCore/_Model/TestEnumerableAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using Z.Test.Linq.Async.Model; 6 | 7 | namespace Z.Test.Linq.Async 8 | { 9 | public class TestEnumerableAsync : IEnumerable where T : Task 10 | { 11 | public TestEnumerableAsync(List originalValues) 12 | { 13 | CurrentIndex = -1; 14 | OriginalValues = originalValues; 15 | } 16 | 17 | public TestEnumerableAsync(List originalValues, Func errorPredicate) 18 | { 19 | CurrentIndex = -1; 20 | ErrorPredicate = errorPredicate; 21 | OriginalValues = originalValues; 22 | } 23 | 24 | public List OriginalValues { get; set; } 25 | 26 | public int CurrentIndex { get; set; } 27 | 28 | public Func ErrorPredicate { get; set; } 29 | 30 | public IEnumerator GetEnumerator() 31 | { 32 | return new TestEnumeratorAsync(this); 33 | } 34 | 35 | IEnumerator IEnumerable.GetEnumerator() 36 | { 37 | return GetEnumerator(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/lab/Z.Lab.LinqAsync.NetCore/_Model/TestPredicate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Z.Test.Linq.Async.Model 4 | { 5 | public class TestPredicate 6 | { 7 | public Func ErrorPredicate; 8 | public Func OriginalPredicate; 9 | 10 | public TestPredicate(Func originalPredicate) 11 | { 12 | OriginalPredicate = originalPredicate; 13 | } 14 | 15 | public TestPredicate(Func originalPredicate, Func errorPredicate) 16 | { 17 | ErrorPredicate = errorPredicate; 18 | OriginalPredicate = originalPredicate; 19 | } 20 | 21 | public int Count { get; set; } 22 | 23 | public bool Predicate(T item) 24 | { 25 | Count++; 26 | 27 | if (ErrorPredicate != null && ErrorPredicate(item)) 28 | { 29 | throw new Exception("TestPredicate;ErrorPredicate;Value=" + item); 30 | } 31 | 32 | return OriginalPredicate(item); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/lab/Z.Lab.LinqAsync.NetCore/_Model/TestPredicateAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Z.Test.Linq.Async.Model 5 | { 6 | public class TestPredicateAsync 7 | { 8 | public Func> ErrorPredicate; 9 | public Func> OriginalPredicate; 10 | 11 | public TestPredicateAsync(Func> originalPredicate) 12 | { 13 | OriginalPredicate = originalPredicate; 14 | } 15 | 16 | public TestPredicateAsync(Func> originalPredicate, Func> errorPredicate) 17 | { 18 | ErrorPredicate = errorPredicate; 19 | OriginalPredicate = originalPredicate; 20 | } 21 | 22 | public int Count { get; set; } 23 | 24 | 25 | public async Task Predicate(T item) 26 | { 27 | Count++; 28 | 29 | if (ErrorPredicate != null && await ErrorPredicate(item).ConfigureAwait(false)) 30 | { 31 | throw new Exception("TestPredicateAsync;ErrorPredicateAsync;Value=" + item); 32 | } 33 | 34 | return await OriginalPredicate(item).ConfigureAwait(false); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/ExceptionHandling.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Z.Test.Linq.Async 4 | { 5 | [TestClass] 6 | public partial class ExceptionHandling 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/ExceptionHandling/ToListError.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using Z.Linq; 6 | 7 | namespace Z.Test.Linq.Async 8 | { 9 | public partial class ExceptionHandling 10 | { 11 | [TestMethod] 12 | public async Task ToListError() 13 | { 14 | var list = new List {1, 2, 3, 4, 5}; 15 | var enumerableError = new TestEnumerable(list, x => x > 2); 16 | 17 | try 18 | { 19 | await enumerableError.ToListAsync(); 20 | 21 | throw new Exception("Oops!"); 22 | } 23 | catch (Exception ex) 24 | { 25 | // MUST throw an error 26 | Assert.AreEqual("TestEnumerable;ErrorPredicate;Value=3", ex.Message); 27 | 28 | // MUST have only 3 iterations for enumerableError 29 | Assert.AreEqual(2, enumerableError.CurrentIndex); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/OrderByCompletion.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Z.Test.Linq.Async 4 | { 5 | [TestClass] 6 | public partial class OrderByCompletion 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/OrderByCompletion/IsOrdered.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Z.Linq; 5 | 6 | namespace Z.Test.Linq.Async 7 | { 8 | public partial class OrderByCompletion 9 | { 10 | [TestMethod] 11 | public async Task IsOrdered() 12 | { 13 | var listTask = new List> 14 | { 15 | Task.Delay(600).ContinueWith(task => 1), 16 | Task.Delay(200).ContinueWith(task => 2), 17 | Task.Delay(800).ContinueWith(task => 3), 18 | Task.Delay(500).ContinueWith(task => 4), 19 | Task.Delay(300).ContinueWith(task => 5) 20 | }; 21 | 22 | var result = listTask.OrderByCompletion(); 23 | 24 | // MUST be ordered be completion 25 | Assert.AreEqual(2, await result[0]); 26 | Assert.AreEqual(5, await result[1]); 27 | Assert.AreEqual(4, await result[2]); 28 | Assert.AreEqual(1, await result[3]); 29 | Assert.AreEqual(3, await result[4]); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/OrderByPredicateCompletion.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Z.Test.Linq.Async 4 | { 5 | [TestClass] 6 | public partial class OrderByPredicateCompletion 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/PredicateAsync_StartConcurrentlyAndOrderByCompletion.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Z.Test.Linq.Async 4 | { 5 | [TestClass] 6 | public partial class PredicateAsync_StartConcurrentlyAndOrderByCompletion 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/SelectResult.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Z.Test.Linq.Async 4 | { 5 | [TestClass] 6 | public partial class SelectResult 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/SelectResult/IsOrdered.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Z.Linq; 5 | 6 | namespace Z.Test.Linq.Async 7 | { 8 | public partial class SelectResult 9 | { 10 | [TestMethod] 11 | public async Task IsOrdered() 12 | { 13 | var listTask = new List> 14 | { 15 | Task.Delay(600).ContinueWith(task => 1), 16 | Task.Delay(200).ContinueWith(task => 2), 17 | Task.Delay(800).ContinueWith(task => 3), 18 | Task.Delay(500).ContinueWith(task => 4), 19 | Task.Delay(300).ContinueWith(task => 5) 20 | }; 21 | 22 | var result = await listTask.SelectResult().ToList(); 23 | 24 | // MUST be ordered be completion 25 | Assert.AreEqual(1, result[0]); 26 | Assert.AreEqual(2, result[1]); 27 | Assert.AreEqual(3, result[2]); 28 | Assert.AreEqual(4, result[3]); 29 | Assert.AreEqual(5, result[4]); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/SelectResult/OrderByCompletion_IsOrdered.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Z.Linq; 5 | 6 | namespace Z.Test.Linq.Async 7 | { 8 | public partial class SelectResult 9 | { 10 | [TestMethod] 11 | public async Task OrderByCompletion_IsOrdered() 12 | { 13 | var listTask = new List> 14 | { 15 | Task.Delay(600).ContinueWith(task => 1), 16 | Task.Delay(200).ContinueWith(task => 2), 17 | Task.Delay(800).ContinueWith(task => 3), 18 | Task.Delay(500).ContinueWith(task => 4), 19 | Task.Delay(300).ContinueWith(task => 5) 20 | }; 21 | 22 | var result = await listTask.OrderByCompletion().SelectResult().ToList(); 23 | 24 | // MUST be ordered be completion 25 | Assert.AreEqual(2, result[0]); 26 | Assert.AreEqual(5, result[1]); 27 | Assert.AreEqual(4, result[2]); 28 | Assert.AreEqual(1, result[3]); 29 | Assert.AreEqual(3, result[4]); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/StartPredicateConcurrently.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Z.Test.Linq.Async 4 | { 5 | [TestClass] 6 | public partial class StartPredicateConcurrently 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/Z.Test.Linq.Async.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/_Model/TestEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Z.Test.Linq.Async.Model; 5 | 6 | namespace Z.Test.Linq.Async 7 | { 8 | public class TestEnumerable : IEnumerable 9 | { 10 | public TestEnumerable(List originalValues) 11 | { 12 | CurrentIndex = -1; 13 | OriginalValues = originalValues; 14 | } 15 | 16 | public TestEnumerable(List originalValues, Func errorPredicate) 17 | { 18 | CurrentIndex = -1; 19 | ErrorPredicate = errorPredicate; 20 | OriginalValues = originalValues; 21 | } 22 | 23 | public List OriginalValues { get; set; } 24 | 25 | public int CurrentIndex { get; set; } 26 | 27 | public Func ErrorPredicate { get; set; } 28 | 29 | public IEnumerator GetEnumerator() 30 | { 31 | return new TestEnumerator(this); 32 | } 33 | 34 | IEnumerator IEnumerable.GetEnumerator() 35 | { 36 | return GetEnumerator(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/_Model/TestEnumerableAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using Z.Test.Linq.Async.Model; 6 | 7 | namespace Z.Test.Linq.Async 8 | { 9 | public class TestEnumerableAsync : IEnumerable where T : Task 10 | { 11 | public TestEnumerableAsync(List originalValues) 12 | { 13 | CurrentIndex = -1; 14 | OriginalValues = originalValues; 15 | } 16 | 17 | public TestEnumerableAsync(List originalValues, Func errorPredicate) 18 | { 19 | CurrentIndex = -1; 20 | ErrorPredicate = errorPredicate; 21 | OriginalValues = originalValues; 22 | } 23 | 24 | public List OriginalValues { get; set; } 25 | 26 | public int CurrentIndex { get; set; } 27 | 28 | public Func ErrorPredicate { get; set; } 29 | 30 | public IEnumerator GetEnumerator() 31 | { 32 | return new TestEnumeratorAsync(this); 33 | } 34 | 35 | IEnumerator IEnumerable.GetEnumerator() 36 | { 37 | return GetEnumerator(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/_Model/TestPredicate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Z.Test.Linq.Async.Model 4 | { 5 | public class TestPredicate 6 | { 7 | public Func ErrorPredicate; 8 | public Func OriginalPredicate; 9 | 10 | public TestPredicate(Func originalPredicate) 11 | { 12 | OriginalPredicate = originalPredicate; 13 | } 14 | 15 | public TestPredicate(Func originalPredicate, Func errorPredicate) 16 | { 17 | ErrorPredicate = errorPredicate; 18 | OriginalPredicate = originalPredicate; 19 | } 20 | 21 | public int Count { get; set; } 22 | 23 | public bool Predicate(T item) 24 | { 25 | Count++; 26 | 27 | if (ErrorPredicate != null && ErrorPredicate(item)) 28 | { 29 | throw new Exception("TestPredicate;ErrorPredicate;Value=" + item); 30 | } 31 | 32 | return OriginalPredicate(item); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/Z.Test.Linq.Async/_Model/TestPredicateAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Z.Test.Linq.Async.Model 5 | { 6 | public class TestPredicateAsync 7 | { 8 | public Func> ErrorPredicate; 9 | public Func> OriginalPredicate; 10 | 11 | public TestPredicateAsync(Func> originalPredicate) 12 | { 13 | OriginalPredicate = originalPredicate; 14 | } 15 | 16 | public TestPredicateAsync(Func> originalPredicate, Func> errorPredicate) 17 | { 18 | ErrorPredicate = errorPredicate; 19 | OriginalPredicate = originalPredicate; 20 | } 21 | 22 | public int Count { get; set; } 23 | 24 | 25 | public async Task Predicate(T item) 26 | { 27 | Count++; 28 | 29 | if (ErrorPredicate != null && await ErrorPredicate(item).ConfigureAwait(false)) 30 | { 31 | throw new Exception("TestPredicateAsync;ErrorPredicateAsync;Value=" + item); 32 | } 33 | 34 | return await OriginalPredicate(item).ConfigureAwait(false); 35 | } 36 | } 37 | } --------------------------------------------------------------------------------