title: How can I share constructor code with readonly class members?
body: <p>I have a class, <code>FooBarSet</code> with a single "core" chunk of initialization logic.</p>
  
  <p>A <code>FooBar</code> is made of a <code>Foo</code> and a <code>Bar</code>.  Class <code>FooBarSet</code> is initialized with a list of <code>FooBar</code>.  <code>FooBarSet</code> can <em>also</em> be initialized by separate parallel <code>Foo</code> and <code>Bar</code> lists.</p>
  
  <p>Ideally, I could run it like this:</p>
  
  <pre><code>public class FooBarSet
  {
      private readonly List&lt;FooBar&gt; _list;
  
      // Primary constructor.
      public FooBarSet(List&lt;FooBar&gt; foobarList)
      {
          // Contracts and initialization...
          _list = foobarList;
      }
  
      // Secondary constructor.
      public FooBarSet(List&lt;Foo&gt; fooList, List&lt;Bar&gt; barList) 
      {
          // Zip a new list of new FooBars
          var zipped = fooList.Zip(barList,
                                   (foo, bar) =&gt; new FooBar(foo, bar));
  
          // Call primary constructor with zipped list.
          this(zipped);
      }
  }
  </code></pre>
  
  <p>This is C#, not Java, so <code>this(zipped)</code> is illegal.  The common solution, <a href="https://stackoverflow.com/a/11123026/3367144">as in this answer</a>, is to pull the core initialization into a common private method:</p>
  
  <pre><code>public class FooBarSet
  {
      private readonly List&lt;FooBar&gt; _list;
  
      // Common "constructor" called from actual constructors.
      private Init(List&lt;FooBar&gt; foobarList)
      {
          // Contracts and initialization...
          _list = foobarList;
      }
  
      public FooBarSet(List&lt;FooBar&gt; foobarList)
      {
          Init(foobarList);
      }
  
      public FooBarSet(List&lt;Foo&gt; fooList, List&lt;Bar&gt; barList) 
      {
          var zipped = fooList.Zip(barList,
                                   (foo, bar) =&gt; new FooBar(foo, bar));
  
          Init(zipped);
      }
  
  }
  </code></pre>
  
  <p>However, this doesn't work either, because of the <code>readonly _list</code> field.</p>
  
  <p><strong>Assuming that <code>_list</code> must be <code>readonly</code>, how can I get these constructors to share initialization code?</strong></p>