title: How to exclude properties from output CSV using LinqToCsv
body: <p>I'm using <code>LinqToCsv</code> to output a CSV file based on my below model.</p>
  
  <pre><code>[CsvColumn(Name = "Column_A", FieldIndex = 0)]
  public string PropOne { get; set; }
  
  [CsvColumn(Name = "Column_B", FieldIndex = 1)]
  public bool PropTwo { get; set; }
  
  [CsvColumn(Name = "Column_C", FieldIndex = 2)]
  public bool PropThree { get; set; }
  
  [CsvColumn(Name = "Column_D", FieldIndex = 3)]
  public int PropFour { get; set; }
  
  [CsvColumn(Name = "Column_E", FieldIndex = 4)]
  public string PropFive { get; set; }
  
  //I don't want the below to be output in my CSV
  public int CommonId { get; set; }
  public DifferentViewModel DifferentViewModel { get; set; }
  </code></pre>
  
  <p>To populate <code>PropFour</code> &amp; <code>PropFive</code> I needed to introduce the <code>CommonId</code> and <code>DifferentViewModel</code> properties to the original model. The problem I have now is when I write the file it is including these two properties, even though I have not given them a field index.</p>
  
  <p>I have tried setting:</p>
  
  <pre><code>IgnoreUnknownColumns = true
  </code></pre>
  
  <p>In the hope that perhaps as I had not decorated these properties, they might be classed as Unknown, however they are still outputted. Is there any way of excluding these properties from the output CSV short of creating a new model minus these properties and mapping to this model prior to the write.</p>
  
  <p><strong>edit</strong></p>
  
  <p>Some further readings shows me that </p>
  
  <blockquote>
    <p>"Fields and properties without FieldIndex get written last, in random
    order."</p>
  </blockquote>
  
  <p>which explains why these are still showing in my output CSV, and I also now understand that <code>IgnoreUnknownColumns</code> is for reading, not writing, so obviously would have no effect on my unwanted properties being added to my CSV.</p>
  
  <p>But I still cant find anything in the documentation about excluding properties, it looks like I'm going to have to split this model, one for setting up and one for the actual write.</p>