Created
October 26, 2016 11:17
-
-
Save jermdavis/5696495f7bff467fc8039e35a4f218de to your computer and use it in GitHub Desktop.
A possible looped pipeline step for processing IEnumerable<> inputs
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
using System.Collections.Generic; | |
namespace StronglyTypedPipelines | |
{ | |
public class LoopStep<INPUT,OUTPUT> : IPipelineStep<IEnumerable<INPUT>, IEnumerable<OUTPUT>> | |
{ | |
private IPipelineStep<INPUT, OUTPUT> _internalStep; | |
public LoopStep(IPipelineStep<INPUT, OUTPUT> internalStep) | |
{ | |
_internalStep = internalStep; | |
} | |
public IEnumerable<OUTPUT> Process(IEnumerable<INPUT> input) | |
{ | |
foreach(INPUT item in input) | |
{ | |
yield return _internalStep.Process(item); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment