title: C# multi-line lambda expression
body: <p>I want to print a percentage value in one (or more) integer intervals. The code below describes <code>object.ProgressChanged</code> as an <code>EventHandler&lt;EventArgs&gt;</code> and <code>maxPercent</code> as a global <code>int</code> variable.</p>
  
  <pre><code>object.ProgressChanged += (sender, args) =&gt; (
      if (maxPercent &lt; ((int) args.ProgressPercentage)) {
          maxPercent = (int) args.ProgressPercentage;
          Console.WriteLine(maxPercent + "%");
      }
  )
  </code></pre>
  
  <p>I can easily solve this problem by doing this:</p>
  
  <pre><code>object.ProgressChanged += (sender, args) =&gt; aFunction(args);
  </code></pre>
  
  <p>where <code>aFunction</code> contains all the same code after the <code>=&gt;</code> operator in the first piece of code.</p>
  
  <p>I am looking for a more elegant way to approach this problem, if possible, in one line. Any tips?</p>