Skip to content

Instantly share code, notes, and snippets.

@hawx
Last active December 31, 2015 17:38
Show Gist options
  • Save hawx/8021168 to your computer and use it in GitHub Desktop.
Save hawx/8021168 to your computer and use it in GitHub Desktop.
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