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

前端 未结 7 1950
死守一世寂寞
死守一世寂寞 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 07:56

    You can do almost exactly the first example naturally using code blocks in C# 3.0.

    ((accum, data) => { accum.Add(data); return accum; })
    

提交回复
热议问题