title: Include RawRecord in dynamic objects returned from CsvHelper GetRecords
body: <p>I have this working when converting to Class objects, by using a <code>Configuration.RegisterClassMap</code> (in essence I'm mapping <code>row.Context.RawRecord</code> to a property on my Class called <code>RawRecord</code>):</p>
  
  <pre class="lang-cs prettyprint-override"><code>public sealed class RecordMap : ClassMap&lt;CsvRecord&gt;
  {
      public RecordMap()
      {
          AutoMap(CultureInfo.CurrentCulture);
          Map(m =&gt; m.RawRecord).ConvertUsing(row =&gt; row.Context.RawRecord.Replace("\r\n", ""));
      }
  }
  </code></pre>
  
  <p>...but I'm wanting to move away from needing the Class Object (in this example <code>CsvRecord</code>), and rather use a dynamic object with <code>csv.GetRecords&lt;dynamic&gt;()</code>. This is working for me except for the fact that I haven't been able to work out how to get the <code>RawRecord</code>. Ideally if I could add some configuration to simply add it as a new column on the dynamic object, but I can't find anything like that.</p>
  
  <p>I'm using linq to build a list of Domain Objects (<code>Individuals</code>), which includes grouping CSV rows, so I don't want to be iterating through each record manually:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using (var csv = new CsvReader(reader, CultureInfo.CurrentCulture))
  {
      csv.Configuration.PrepareHeaderForMatch = (string header, int index) =&gt; Regex.Replace(header, "[^A-Za-z0-9]", "");
  
      var dateUpdated = DateTime.UtcNow;
      var individuals = csv.GetRecords&lt;dynamic&gt;().ToList().Where(r =&gt; r.GroupType == "Individual").
          GroupBy(r =&gt; r.GroupID).
          Select(g =&gt; new Individual(
              // Include constructor arguments here
              g.Key,
              g.First().Name1
              // ...
              // Include an array of all raw CSV records that have been used to generate this object
              // This currently fails
              g.Select(r =&gt; r.RawRecord).Cast&lt;string&gt;().ToArray()
          )).ToList();
  }
  
  </code></pre>