title: Using the Singleton pattern with an interface in C#
body: <p>Note: Even though there are a lot of similar questions, non that i have found answered my question.</p>
  
  <p>Problem:
  I would like to implement a class in C# which uses the singleton pattern in the following way.</p>
  
  <pre><code>namespace DAL
  {
      public class CDAL : IDAL
      {
          /* Singleton Pattern */
          private CDAL instance = null;
          private CDAL()
          {
          }
          public IDAL getInstance()
          {
              if (instance != null)
              {
                  return instance;
              }
              else
              {
                  CDAL.instance = new CDAL();
                  return CDAL.instance;
              }
          }
      }
  
  }
  </code></pre>
  
  <p>the problem is that <strong>instance</strong> and the method <strong>getInstance</strong> should be <strong>static</strong>, as i want to 'ask' the class for that instance and not an object.
  but using c# i can't seem to do anything static in an interface.</p>
  
  <p>how can i solve this?</p>