title: C# - How can I pass a reference to a function that requires an out variable?
body: <pre><code>public class Foo
  {
      public void DoFoo()
      {
         int x;
         var coll = TheFunc("bar", out x);
      }
  
      public Func&lt;string, int, ICollection&lt;string&gt;&gt; TheFunc { get; set; }
  }
  </code></pre>
  
  <p>Error: <i>"Argument 2 should not be passed with the 'out' keyword."</i></p>
  
  <pre><code>public class Foo
  {
      public void DoFoo()
      {
         int x;
         var coll = TheFunc("bar", out x);
      }
  
      public Func&lt;string, out int, ICollection&lt;string&gt;&gt; TheFunc { get; set; }
  }
  </code></pre>
  
  <p>Error: <i>"Invalid variance modifier. Only interface and delegate type parameters can be specified as variant."</i></p>
  
  <p>How do I get an out parameter in this function?</p>