title: Can I override a list registration in StructureMap/Autofac?
body: <p>For overriding/replacing type registrations both frameworks use the "last registration wins". For collections (multiple implementations of the same interface) however, in both frameworks the collection is added to, never completely overridden/replaced with a new collection:</p>
  
  <pre><code>For&lt;IService&gt;().Use&lt;Service1&gt;();
  For&lt;IService&gt;().Use&lt;Service2&gt;();
  GetInstance&lt;IEnumerable&lt;IService&gt;&gt;() == IEnumerable[Service1, Service2]
  
  // Overriding in child container/profile or Autofac tenant
  For&lt;IService&gt;().Use&lt;Service3&gt;();
  GetInstance&lt;IEnumerable&lt;IService&gt;&gt;() == IEnumerable[Service1, Service2, Service3]
  
  // Even if I use StructureMap's ClearAll
  For&lt;IService&gt;().ClearAll().Use&lt;Service3&gt;();
  GetInstance&lt;IEnumerable&lt;IService&gt;&gt;() == IEnumerable[Service1, Service2, Service3]
  </code></pre>
  
  <p>My expectation is that I should be able to use something to clear or replace the parent registration when it comes to multiple implementations (i.e. collections) so that I can keep a separate list of a particular service in the parent/global and the child/tenant. </p>
  
  <p>(I know StructureMap is no longer maintained and I'm willing to switch to another framework).</p>