title: using csvhelper (nuGET) with C# MVC to import CSV files
body: <p><a href="https://joshclose.github.io/CsvHelper/" rel="nofollow noreferrer">https://joshclose.github.io/CsvHelper/</a> available via NuGet is used to read and write CSV files.</p>
  
  <p>CsvHelper allows you to read your CSV file directly into your custom class.</p>
  
  <p>As following was shown in a previous <a href="https://stackoverflow.com/questions/1103495/is-there-a-proper-way-to-read-csv-files/2315182#2315182">question</a></p>
  
  <pre><code>var streamReader = // Create a reader to your CSV file.
  var csvReader = new CsvReader( streamReader );
  List&lt;MyCustomType&gt; myData = csvReader.GetRecords&lt;MyCustomType&gt;();
  </code></pre>
  
  <blockquote>
    <p>CsvReader will automatically figure
    out how to match the property names
    based on the header row (this is
    configurable). It uses compiled
    expression trees instead of
    reflection, so it's very fast.</p>
    
    <p>It is also very extensible and
    configurable.</p>
  </blockquote>
  
  <p>I'm basically trying to work out how to read in a CSV file with headers (unknown names) and read the records into a custom object.</p>
  
  <p>There is no documentation on this at all so wondered if anyone knew how to use CsvReader to put the values in order into an array of strings or how would you recommend dealing with this?</p>