title: Perversion. Does exist any way to natively use references with lambdas in C#?
body: <p>I have some variables which were given through <code>ref</code> keyword in my function. I want to use ref-variables in lambda expression without using local variables exactly.</p>
  
  <p>I know that C# can't merge lambdas and ref-variables in work. But doesn't exist any perversion to make ref-variables work in lambda-expression?</p>
  
  <p><strong>Pseudo-code (wanna-be C#)</strong>:</p>
  
  <pre><code>T MyFunction&lt;T&gt;(ref T x, ref T y)
  { 
      return (Func&lt;T&gt;) ( () =&gt; ( (100 * (x - y)) / x ) (); 
  } 
  </code></pre>
  
  <p>I want it:</p>
  
  <p><em>1). Be generic.</em></p>
  
  <p><em>2). Accept as arguments the generic-types by references.</em></p>
  
  <p><em>3). Using two options upper make it work with lambdas.</em></p>
  
  <p><em>4). Return the result with using generic.</em></p>
  
  <p><em>5). Be an <strong>organic-programming</strong> code :) Joke.</em></p>
  
  <p>And call smth. like that:</p>
  
  <pre><code>int x = 21, y = 9;
  int result = MyFunction&lt;int&gt;(ref x, ref y);
  </code></pre>
  
  <p>And with other types etc...</p>
  
  <pre><code>double x = 21.5, y = 9.3;
  double result = MyFunction&lt;double&gt;(ref x, ref y);
  </code></pre>
  
  <p>Pity, that such constructions and desires C# couldn't give me, so I'm going to look at Lisp/Haskell ( maybe F# ).</p>
  
  <p>(PS) => ("So I want to have a hard sex with C# possibilities exactly as you can see.")</p>