title: Programmatically adding BehaviorExtensionElement
body: <p>I have a <code>ServiceHost</code> I'm creating programmatically and I'd like to add a <code>Behaviour</code> to it. I can add the Behaviour using <code>host.Description.Behaviors.Add()</code> but I couldn't find a way to add the <code>BehaviorExtensionElement</code> part. There is a <code>host.Extensions</code> collection but it accepts <code>ServiceHostBase</code>. Basically I want to translate this web.config part to code:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name=""&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
            &lt;errorHandler /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;extensions&gt;
        &lt;behaviorExtensions&gt;
          &lt;add name="errorHandler" type="MyService.ErrorHandlerBehaviorExtensionElement, MyService" /&gt;
        &lt;/behaviorExtensions&gt;
      &lt;/extensions&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>