Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anaisbetts/LinqToAwait
A Task-based LINQ designed to work with async/await
https://github.com/anaisbetts/LinqToAwait
Last synced: 3 months ago
JSON representation
A Task-based LINQ designed to work with async/await
- Host: GitHub
- URL: https://github.com/anaisbetts/LinqToAwait
- Owner: anaisbetts
- License: mit
- Created: 2012-04-01T00:56:30.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-28T23:25:34.000Z (over 9 years ago)
- Last Synced: 2024-07-28T14:22:38.836Z (3 months ago)
- Language: C#
- Homepage: http://xpaulbettsx.github.com/LinqToAwait/
- Size: 370 KB
- Stars: 112
- Watchers: 9
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xamarin - LinqToAwait ★99 - A Task-based LINQ designed to work with async/await. (Async)
README
## LinqToAwait
In a world where many methods return `Task` or other Awaitable types
(especially in WinRT), LINQ can't be used nearly as easily. Enter LinqToAwait:```
using System;
using System.Reactive.Linq;
using LinqToAwait;var inputs = new[] {
"http://www.google.com",
"http://www.yahoo.com",
"http://www.aol.com",
};IEnumerable results = await inputs.AsAsync()
.WhereAsync(async x => await IsPageInTop10WebSitesByTrafficAsync(x))
.SelectAsync(async x => await DownloadPageAsync(x))
.Select(x => x.Substring(0, 50))
.GetResults();>>> ["...."]
```### Where does this work?
You're going to need Visual Studio 2012 - you can use LinqToAwait with .NET 4.5 applications.
### Hey, isn't this kind of like Rx?
It **is** Rx! However, it is a simplification of the API used for a more
specific use-case. Instead of choosing async/await *or* Rx, LinqToAwait helps
you use both at the same time, applying the most straightforward technique for
the particular problem.### How do I get started?
It's .NET, how else? [Use NuGet!](http://nuget.org/packages/linqtoawait).
```
Install-Package LinqToAwait
```