title: Solution for CA2227 or better approach?
body: <p>I'm only using Code Analysis for cleaning, organizing and ensuring these changes are globally performed for all instances of a particular warning. I'm down to the final, and it's CA2227.</p>
  
  <blockquote>
    <p>CA2227    Collection properties should be read only   Change '' to be
    read-only by removing the property setter.</p>
  </blockquote>
  
  <p><em>Note this is for mapping of EDI documents. These classes are to represent a whole or part of an EDI document.</em></p>
  
  <pre><code>public class PO1Loop
  {
  
      public SegmentTypes.PO1LoopSegmentTypes.PO1 PO1 { get; set; }
  
      public Collection&lt;SegmentTypes.PO1LoopSegmentTypes.PID1&gt; PIDRepeat1 { get; set; }
  
      public Collection&lt;SegmentTypes.PO1LoopSegmentTypes.PID2&gt; PIDRepeat2 { get; set; }
  
      public SegmentTypes.PO1LoopSegmentTypes.PO4 PO4 { get; set; }
  
      /* Max Use: 8 */
      public Collection&lt;SegmentTypes.PO1LoopSegmentTypes.ACK&gt; ACKRepeat { get; set; }
  
  }
  </code></pre>
  
  <p>You can see all of the Collection properties will give me this warning, and there are hundreds of them. When using the above class I instantiate it without any data. Then externally I add the data and set each individual variable through its public accessor. I do not instantiate this class with all the data prepared and passed using a constructor method (IMO for the size these can reach it can easily wreak havoc on the eyes). When complete and all properties are assigned the class as a whole is then used to generate that part of a document it represents.</p>
  
  <p>My question is, for the usage described above, what would be a better approach for setting this up correctly? Do I keep the public accessors and suppress this warning entirely, or is there a entirely different solution that would work?</p>