Is there idiomatic C# equivalent to C's comma operator?

前端 未结 7 1963
死守一世寂寞
死守一世寂寞 2020-12-14 07:18

I\'m using some functional stuff in C# and keep getting stuck on the fact that List.Add doesn\'t return the updated list.

In general, I\'d like to call

7条回答
  •  庸人自扰
    2020-12-14 08:05

    I know this as Fluent.

    A Fluent example of a List.Add using Extension Methods

    static List MyAdd(this List list, T element)
    {
        list.Add(element);
        return list;
    }
    

提交回复
热议问题