-
-
Save lucamilan/f615146bf0b8d391deb33a860870c5f0 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