title: Should you declare methods using overloads or optional parameters in C# 4.0?
body: <p>I was watching <a href="http://channel9.msdn.com/pdc2008/TL16/" rel="noreferrer">Anders' talk about C# 4.0 and sneak preview of C# 5.0</a>, and it got me thinking about when optional parameters are available in C# what is going to be the recommended way to declare methods that do not need all parameters specified?</p>
  
  <p>For example something like the <code>FileStream</code> class has about fifteen different constructors which can be divided into logical 'families' e.g. the ones below from a string, the ones from an <code>IntPtr</code> and the ones from a <code>SafeFileHandle</code>.</p>
  
  <pre><code>FileStream(string,FileMode);
  FileStream(string,FileMode,FileAccess);
  FileStream(string,FileMode,FileAccess,FileShare);
  FileStream(string,FileMode,FileAccess,FileShare,int);
  FileStream(string,FileMode,FileAccess,FileShare,int,bool);
  </code></pre>
  
  <p>It seems to me that this type of pattern could be simplified by having three constructors instead, and using optional parameters for the ones that can be defaulted, which would make the different families of constructors more distinct [note: I know this change will not be made in the BCL, I'm talking hypothetically for this type of situation].</p>
  
  <p>What do you think? From C# 4.0 will it make more sense to make closely related groups of constructors and methods a single method with optional parameters, or is there a good reason to stick with the traditional many-overload mechanism?</p>