Last active
December 31, 2015 17:38
-
-
Save hawx/8021168 to your computer and use it in GitHub Desktop.
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
public static class Exts | |
{ | |
public static T Tap<T>(this T that, Action<T> action) | |
{ | |
action(that); | |
return that; | |
} | |
public static TOut Into<TIn, TOut>(this TIn that, Func<TIn, TOut> func) | |
{ | |
return func(that); | |
} | |
} | |
public class TestExts | |
{ | |
public string Logging() | |
{ | |
return "hello".Tap(v => Console.WriteLine("DoStuff: " + v)); | |
} | |
public string Waterfall() | |
{ | |
return "hello".Into(v => v + " ") | |
.Into(v => v + "world") | |
.Into(v => v.ToUpper()) | |
.Into(v => v + "!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment