Created
September 20, 2018 05:20
-
-
Save FuncLun/1eb07f450ca57fac05785688f80672bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//C# Pipeline example | |
var tasks = myObject | |
.Select(o => o.MyString) | |
.Where(s => s != null) | |
.Select(s => new Request() { Message = s }) | |
.Select(r => r.Send(mediator)) | |
.ToArray(); | |
await Task.WhenAll(tasks); //There should be an extension `Task WhenAll(this IEnumerable<Task>)` | |
//C# Non-Pipeline example | |
await Task.WhenAll( | |
Enumerable.ToArray( | |
Enumerable.Select( | |
Enumerable.Select( | |
Enumerable.Where( | |
Enumerable.Select( | |
myObject, | |
o => o.MyString | |
), | |
s=> s != null | |
), | |
s => new Request() { Message = s } | |
), | |
r => mediator.Send(r) | |
), | |
) | |
); | |
//PowerShell Pipeline example | |
Get-Process notepad ` | |
| Stop-Process | |
//PowerShell Non-Pipeline example | |
Stop-Process -InputObject ( ` | |
Get-Process notepad ` | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment