Pipe forwards in C#

前端 未结 4 1267
醉酒成梦
醉酒成梦 2020-12-02 14:51

Continuing my investigation of expressing F# ideas in C#, I wanted a pipe forward operator. For anything wrapped in a IEnumerable, we already have it, as you can .NextFunc()

4条回答
  •  醉梦人生
    2020-12-02 15:13

    Your Pipe method looks a whole lot like the Thrush Combinator. My implementation of it is very simple.

    public static T Into(this T obj, Func f)
    { return f(obj); }
    

提交回复
热议问题