title: Is there idiomatic C# equivalent to C's comma operator?
body: <p>I'm using some functional stuff in C# and keep getting stuck on the fact that <code>List.Add</code> doesn't return the updated list.</p>
  
  <p>In general, I'd like to call a function on an object and then return the updated object.</p>
  
  <p>For example it would be great if C# had a comma operator:</p>
  
  <pre><code>((accum, data) =&gt; accum.Add(data), accum)
  </code></pre>
  
  <p>I could write my own "comma operator" like this:</p>
  
  <pre><code>static T comma(Action a, Func&lt;T&gt; result) {
      a();
      return result();
  }
  </code></pre>
  
  <p>It looks like it would work but the call site would ugly. My first example would be something like:</p>
  
  <pre><code>((accum, data) =&gt; comma(accum.Add(data), ()=&gt;accum))
  </code></pre>
  
  <p>Enough examples! What's the cleanest way to do this without another developer coming along later and wrinkling his or her nose at the code smell?</p>