title: How to use IEnumerable<T> in a class constructor parameter
body: <p>I am trying to make some code in my MVC controller (export to Excel) more generic, as I've reached the point where I'm typing out almost identical code in multiple controllers. To make the export to Excel function so that exists in only one place -- rather than in many places -- I had the idea of using a generic IEnumerable so I could feed <em>any</em> IEnumerable into the class. (See code block below.)</p>
  
  <p>I know that I can use byte[] as a parameter (and I might still use that as an other constructor choice), but it would be nice if I could use an IEnumerable in this instance.</p>
  
  <p>However, Intellisense immediately tells me that "the type or namespace T could not be found". </p>
  
  <p>Is is possible to use <code>IEnumerable&lt;T&gt;</code> for this purpose?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace WebApplication1.CentralFunctions
  {
      public class ExportToExcel
      {
          ExportToExcel(IEnumerable&lt;T&gt; inputCollection)
          {
              // TODO: place my "export to excel" commands here.
          }
      }
  }
  </code></pre>