title: Conditional Builder Method Chaining Fluent Interface
body: <p>I was wondering what would be the best way to implement a <code>.When</code> condition in a <strong>fluent interface</strong> using <strong>method chaining</strong> in a <code>Builder</code> object?</p>
  
  <p>For instance how would I implement the <code>.WithSkill()</code> and <code>.When()</code> methods in the following example:</p>
  
  <pre><code>var level = 5;
  
  var ninja = NinjaBuilder
      .CreateNinja()
      .Named("Ninja Boy")
      .AtLevel(level)
      .WithShurikens(10)
      .WithSkill(Skill.HideInShadows)
          .When(level &gt; 3)
      .Build()
  </code></pre>
  
  <p><strong>Update</strong> - A sample solution can be found <a href="http://kenny-bu.blogspot.com/2012/04/conditional-builder.html" rel="noreferrer">here</a>.</p>