public static class PipingExtensions { /// /// Take an object, pipe it into a function, and return the result. /// /// /// /// /// /// public static T2 Pipe(this T obj, Func f) { return f(obj); } /// /// Pipes object it into a function, and returns object. /// /// /// /// /// useful for encapsulating procedural void method calls public static T PipeKeep(this T obj, Action f) { f(obj); return obj; } /// /// Pipes object into a void function (action) /// /// /// /// /// for cases where the output is to be ignored public static void PipeVoid(this T obj, Action f) { f(obj); } }