title: Why are C# 4 optional parameters defined on interface not enforced on implementing class?
body: <p>I noticed that with the optional parameters in C# 4 if you specify an  optional parameter on an interface you <strong><em>don,t</em></strong> have to make that parameter optional on any implementing class:</p>
  
  <pre><code>public interface MyInterface
  {
      void TestMethod(bool flag = false);
  }
  
  public class MyClass : MyInterface
  {
      public void TestMethod(bool flag)
      {
          Console.WriteLine(flag);
      }
  }
  </code></pre>
  
  <p>and therefore:</p>
  
  <pre><code>var obj = new MyClass();        
  obj.TestMethod(); // compiler error
  
  var obj2 = new MyClass() as MyInterface;
  obj2.TestMethod(); // prints false
  </code></pre>
  
  <p>Does anyone know why optional parameters are designed to work this way?</p>
  
  <p>On one hand I suppose the ability to override any default values specified on the interfaces is useful though to be honest I'm not sure if you should even be able to specify default values on the interface as that should be an implementation decision.</p>
  
  <p>On the other hand, this disconnect means you can't always use the concrete class and the interface interchangeably. This of course, wouldn't be a problem if the default value is specified on the implementation, but then if you're exposing your concrete class as the interface (using some IOC framework to inject the concrete class for instance) then really there's no point having the default value as the caller will have to always provide it anyway.</p>