title: Conditionally Call Constructor in C#
body: <p>Let's say I have the following constructors for <code>Foo</code> in C#:</p>
  
  <pre><code>public Foo()
  {
      // ...
  }
  protected Foo(bool connect)
      : this()
  {
      // ...
  }
  </code></pre>
  
  <p>I am searching for a way to only execute the <code>this()</code> part whenever the <code>connect</code> parameter is <code>true</code>. Is these a way to do this?</p>
  
  <p>(For curious people: The reasoning behind this is that the <code>Foo</code> class creates objects that connect to certain things; when they are created, they should always try to connect as well. Right now, I am creating an emulator (or MOCK) for it which extends the <code>Foo</code> class. That's what I'm adding the <code>protected</code> constructor for; when this one is used, there should be the option to not create an actual connection. I want to implement this while changing the <code>Foo</code> class as little as possible.)</p>