Created
May 9, 2012 21:27
-
-
Save banbh/2649032 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| static void Foo() | |
| { | |
| //Action<Action<int>, Action<string>> a = (a1, a2) => Example(3, a1, a2); | |
| //var aa = a.MergeYields().AsEnumerable(); | |
| var x = MergeYields<int, string>((a1, a2) => Example(3, a1, a2)); | |
| Func<int, IEnumerable<Either<int, string>>> f = n => | |
| MergeYields<int, string>((a1, a2) => Example(n, a1, a2)) | |
| .AsEnumerable(); | |
| var tb = new TransformManyBlock<int, Either<int, string>>(f); | |
| ITargetBlock<int> intSink = null; | |
| //IPropagatorBlock<Either<int,string>, int> | |
| var left = new TransformBlock<Either<int, string>, int>(either => either.Left1); | |
| left.LinkTo(intSink); | |
| var right = new TransformBlock<Either<int, string>, string>(either => either.Right1); | |
| ITargetBlock<string> stringSink = null; | |
| right.LinkTo(stringSink); | |
| tb.LinkTo(left, either => either.IsLeft); | |
| tb.LinkTo(right, either => either.IsRight); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment