title: Elegantly passing lists and objects as params
body: <p>In C#, one can use the <code>params</code> keyword to specify an arbitrary number of typed parameters to a method:</p>
  
  <pre><code>public void DoStuff(params Foo[] foos) {...}
  
  public void OtherStuff {
      DoStuff(foo1);
      DoStuff(foo2, foo3);
  }
  </code></pre>
  
  <p>If you already have a list of objects, you can turn it into an array to pass to this method:</p>
  
  <pre><code>DoStuff(fooList.ToArray());
  </code></pre>
  
  <p>However, is there any elegant way to mix-n-match? That is, to pass in multiple objects and lists of objects and have the results flattened into one list or array for you? Ideally, I would like to be able to call my method like this:</p>
  
  <pre><code>DoStuff(fooList, foo1, foo2, anotherFooList, ...);
  </code></pre>
  
  <p>As of right now, the only way I know how to do this is to pre-process everything into one list, and I don't know of any way to do this generically.</p>
  
  <p><strong>Edit:</strong> To be clear, I'm not married to the <code>params</code> keyword, it's just a related mechanism that helped me explain what I wanted to do. I'm quite happy with any solution that looks clean and flattens everything into a single list.</p>