title: How to use strategy pattern together with dependency injection (autofac)
body: <p>I'd like to join use of Strategy pattern and DI.</p>
  
  <pre><code>class A : IBase
  {
      public void Do();
  }
  
  class B : IBase
  {
      public void Do();
  }
  
  interface IBase
  {
      void Do();
  }
  
  class Context()
  {
      private _usedClass;
      void SetClass(IBase usedClass)
      {
          _usedClass = usedClass;
      }
  
      public void Do()
      {
          _usedClass.Do();
      }
  }
  
  void Main()
  {
      var context = new Context();
      var someEnum = SomeMethod();
  
      //how to use here DI resolve to get appropriate class instead of if/else?
      if (someEnum == MyEnum.A)
          context.SetClass(new A());
      else if (someEnum == MyEnum.B)
          context.SetClass(new B());
  
      context.Do();
  }
  </code></pre>
  
  <p>How to use here DI resolve to get appropriate class instead of if/else?
  Thanks</p>