title: Two instances of a singleton needed
body: <p>I had to extend my existing code with a Class B. The existing code uses a singleton in Library. Now Class B (which itself will be available as a singleton as is Class A) needs its own library instance...</p>
  
  <p>I'm wondering what's the best way to extend the existing code (Class A, Library) such that I have to change the library as less as possible.</p>
  
  <pre><code>public class A 
  {
      var lib = Library.Instance;
  
      public DoSomething()
      {
          lib.DoStuff();
      }    
  }
  
  public class B
  {
      var lib = Library.Instance;  //wrong! needs its own instance
  
      public DoSomething()
      {
          lib.DoOtherStuff();
      }    
  }
  
  public class Library
  {
      public static Library Instance
      {
          get
          {
              return _librarySingleton;
          }
      }
  
      //library internally uses singleton too!!
  }
  
  public static class MyProgram
  {
      var a = new A();    //will be an singleton
      var b = new B();    //will be an singleton
  
      a.DoSomething();
      b.DoSomething();
  }
  </code></pre>
  
  <p>There will never be another class. So two instances will be just fine.</p>