Skip to content

Commit f79c0f5

Browse files
author
Oren (electricessence)
committed
Updated readme.
1 parent 9678c67 commit f79c0f5

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@ A set of extensions for optimizing/simplifying System.Threading.Channels usage.
88

99
## Highlights
1010

11+
### Read & Write
12+
13+
*With optional concurrency levels.*
14+
15+
* Reading all entries in a channel.
16+
* Writing all entries from a source to a channel.
17+
* Piping (consuming) all entries to a buffer (channel).
18+
* `.AsAsyncEnumerable()` (`IAsyncEnumerable`) support for .NET Standard 2.1+ and .NET Core 3+
19+
20+
### Special `ChannelReader` Operations
21+
22+
* `Filter`
23+
* `Transform`
24+
* `Batch`
25+
* `Join`
26+
27+
---
28+
29+
## Examples
30+
1131
Being able to define an asynchronous pipeline with best practice usage using simple expressive syntax:
1232

1333
```cs
@@ -37,8 +57,6 @@ await source /* IEnumerable<T> */
3757
});
3858
```
3959

40-
## Examples
41-
4260
### Reading (until the channel is closed)
4361

4462
#### One by one read each entry from the channel
@@ -101,6 +119,32 @@ await channel.WriteAllConcurrentlyAsync(
101119
maxConcurrency, source, complete: true);
102120
```
103121

122+
### Filter & Transform
123+
124+
```cs
125+
// Filter and transform when reading.
126+
channel.Reader
127+
.Filter(predicate) // .Where()
128+
.Transform(selector) // .Select()
129+
.ReadAllAsync(async value => {/*...*/});
130+
```
131+
132+
### Batching
133+
134+
```cs
135+
values.Reader
136+
.Batch(10 /*batch size*/)
137+
.ReadAllAsync(async batch => {/*...*/});
138+
```
139+
140+
### Joining
141+
142+
```cs
143+
batches.Reader
144+
.Join()
145+
.ReadAllAsync(async value => {/*...*/});
146+
```
147+
104148
### Pipelining / Transforming
105149

106150
#### Transform and buffer entries

0 commit comments

Comments
 (0)