Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public class CompositeStrategy : IStrategy
  2. {
  3. private readonly IEnumerable<IStrategy> _strategies;
  4.  
  5. public CompositeStrategy(IEnumerable<IStrategy> strategies)
  6. => _strategies = strategies;
  7.  
  8. public State GetNewState(State state, UserInput userInput)
  9. => _strategies.Aggregate(
  10. state,
  11. (acc, strategy) => strategy.GetNewState(acc, userInput));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement