title: SimpleInjector dictionary as constructor argument
body: <p>I'm trying to set up a container to register a class that takes in its constructor a <code>IDictionary&lt;string, IInterface&gt;</code> so in my IoC I would like to know how to get a named instance (if that feature is available in SI). An example of what I want to achieve is:</p>
  
  <pre><code>container.Register&lt;IOtherInterface&gt;(() =&gt; 
      new OtherInterface(new Dictionary&lt;string, IInterface&gt;
      {
          { "a", container.GetInstance&lt;IInterface&gt;("named-a") },
          { "b", container.GetInstance&lt;IInterface&gt;("named-b") },
      });
  </code></pre>
  
  <p>Is there any way to configure this?</p>
  
  <p>Updated:</p>
  
  <p>The implementation of the interface is the same object with different parameters and that's an example I haven't been able to see in the SI documentation <a href="https://simpleinjector.readthedocs.io/en/latest/howto.html#resolve-instances-by-key" rel="nofollow noreferrer">https://simpleinjector.readthedocs.io/en/latest/howto.html#resolve-instances-by-key</a> . I'd like to avoid the fact that I have to instantiate a new Interface(..with the relevant parameters...) for each value in the dictionary that's why I thought that naming a registration was something available in SI.</p>
  
  <p>Maybe my approach is wrong and I should try to establish the dependencies in a different way.</p>
  
  <p>Example of usage:</p>
  
  <pre><code>public class OtherInterface : IOtherInterface
  {
     private readonly IDictionary&lt;string, IInterface&gt; _interfces;
  
     public OtherInterface(IDictionary&lt;string, IInterface&gt; interfaces)
     {
         _interfaces = interfaces;
     }
  
     public void DoSomething(MyRequest request)
     {
         if(_interfaces.ContainKey(request.SelectMyInterface))
         {
             _interfaces[request.SelectMyInterface].DoSpecificStuff();
         }
     }
  }
  </code></pre>
  
  <p>I could potentially extend the interface IInterface and apply the strategy pattern here having a method like <code>Applies(string type)</code> but I have used the dictionary approach in the past with Ninject.</p>