title: Convert to decimal when using CsvHelper
body: <p>When I try to use CsvHelper to parse the below CSV, I get a &quot;conversion cannot be performed&quot; error (full error is below). It looks like I'm missing something about how to deal with reading values as decimals. Have seen some other answers relating to setting the culture, but that doesn't seem to have helped.</p>
  <p>The CSV data is:</p>
  <pre><code>Title,Amount,NHS,Reference,GoCardless ID,email,surname,firstname,Full Name,DOB,Age,Right Lens,Left Lens,RightLensMonthlyAmount,LeftLensMonthlyAmount,LensMonthlyAmount,FeeMonthlyAmount,VAT Basis,LensBespokePrice,CareOnly,Notes
  Mrs,24.3,N,100247,CUXXX,email@gmail.com,User,Test,Test User,17/09/1957,64,DAILIES® AquaComfort PLUS 30 Pack,DAILIES® AquaComfort PLUS 30 Pack,16.5,16.5,33,6.35,,,,
  </code></pre>
  <p>My class to map this data to properties is:</p>
  <pre><code>public class Payer
      {
          public string Title { get; set; }
          public decimal Amount { get; set; }
  
          [BooleanTrueValues(&quot;Y&quot;)]
          [BooleanFalseValues(&quot;N&quot;)]
          public bool NHS { get; set; }
  
          public string Reference { get; set; }
  
          [Name(&quot;GoCardless ID&quot;)]
          public string GoCardless_ID { get; set; }
  
          public string email { get; set; }
          public string surname { get; set; }
          public string firstname { get; set; }
  
          [Name(&quot;Full Name&quot;)]
          public string Fullname { get; set; }
  
          [Name(&quot;DOB&quot;)]
          public string Dob { get; set; }
  
          public int Age { get; set; }
  
          [Name(&quot;Right Lens&quot;)]
          public string RightLens { get; set; }
          [Name(&quot;Left Lens&quot;)]
          public string LeftLens { get; set; }
  
          public decimal RightLensMonthlyAmount { get; set; }
          public decimal LeftLensMonthlyAmount { get; set; }
          public decimal LensMonthlyAmount { get; set; }
          public decimal FeeMonthlyAmount { get; set; }
  
          [Name(&quot;VAT Basis&quot;)]
          public string VATBasis { get; set; }
  
          public decimal LensBespokePrice { get; set; }
  
          [BooleanTrueValues(&quot;Y&quot;)]
          public bool CareOnly { get; set; }
  
      }
  </code></pre>
  <p>My code related to parsing the CSV is:</p>
  <pre><code>static void Main(string[] args)
      {
          var culture = new CultureInfo(&quot;en-GB&quot;);
          var config = new CsvHelper.Configuration.CsvConfiguration(culture);
  
          using (var reader = new StreamReader(&quot;test.csv&quot;))
          using (var csv = new CsvReader(reader, config))
          {
              var records = csv.GetRecords&lt;Payer&gt;();
              Console.WriteLine(&quot;Got records&quot;); //this prints on the console
              foreach (var payer in records)
              {
                  Console.WriteLine(payer);
              }
          }
          
  
      }
  </code></pre>
  <p>The error only happens with the <code>foreach</code> loop, not the actual <code>GetRecords()</code> method.</p>
  <p><strong>Full error:</strong></p>
  <blockquote>
  <p>CsvHelper.TypeConversion.TypeConverterException: &quot;The conversion cannot be performed.\n    Text: ''\n    MemberType: System.Decimal\n    TypeConverter: 'CsvHelper.TypeConversion.DecimalConverter'\nIReader state:\n   ColumnCount: 0\n   CurrentIndex: 18\n   HeaderRecord:\n[&quot;Title&quot;,&quot;Amount&quot;,&quot;NHS&quot;,&quot;Reference&quot;,&quot;GoCardless ID&quot;,&quot;email&quot;,&quot;surname&quot;,&quot;firstname&quot;,&quot;Full Name&quot;,&quot;DOB&quot;,&quot;Age&quot;,&quot;Right Lens&quot;,&quot;Left Lens&quot;,&quot;RightLensMonthlyAmount&quot;,&quot;LeftLensMonthlyAmount&quot;,&quot;LensMonthlyAmount&quot;,&quot;FeeMonthlyAmount&quot;,&quot;VAT Basis&quot;,&quot;LensBespokePrice&quot;,&quot;CareOnly&quot;,&quot;Notes&quot;]\nIParser state:\n   ByteCount: 0\n   CharCount: 392\n   Row: 2\n   RawRow: 2\n   Count: 21\n   RawRecord:\nMrs,24.3,N,100247,CUXXX,email@gmail.com,User,Test,Test User,17/09/1957,64,DAILIES® AquaComfort PLUS 30 Pack,DAILIES® AquaComfort PLUS 30 Pack,16.5,16.5,33,6.35,,,,\r\n\n&quot;
  at CsvHelper.TypeConversion.DefaultTypeConverter.ConvertFromString(String text, IReaderRow row, MemberMapData memberMapData)\n   at CsvHelper.TypeConversion.DecimalConverter.ConvertFromString(String text, IReaderRow row, MemberMapData memberMapData)\n   at CsvHelper.Expressions.RecordCreator.CreateT\n   at CsvHelper.Expressions.RecordManager.CreateT\n   at CsvHelper.CsvReader.d__87`1.MoveNext()\n   at dd_journal.Program.Main(String[] args) in /Users/abhi/Documents/Practice/dd-journal/Program.cs:22</p>
  </blockquote>