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
| /// <summary> | |
| /// These extensions provide resilient options for linking to cut down on boilerplate | |
| /// They provide a null link for each real link, meaning that there is a block available which will discard messages | |
| /// This behaivour is only really useful with a predicate; otherwise all blocks will be dropped | |
| /// A default predicate is supplied (this may be dangerous if the caller does not understand the default behaivour?) | |
| /// </summary> | |
| public static class ResilientExtensions { | |
| public static IEnumerable<IDisposable> ResilientLinkTo<TOutput>(this ISourceBlock<TOutput> source, ITargetBlock<TOutput> target) { | |
| var link = source.LinkTo(target, x => x != null); | |
| return GenerateNullLink(source, link); |