Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Program
- {
- public static void Main()
- {
- var x = 5.Bind(Add1)
- .Bind(Times2)
- .Bind(Square);
- }
- public static TOutput Bind<TInput, TOutput>(this TInput input, Func<TInput, TOutput> func)
- {
- return func(input);
- }
- public int Add1(int x) => x + 1;
- public int Times2(int x) => x * 2;
- public int Square(int x) => x * x;
- }
Add Comment
Please, Sign In to add comment