Now that we have extension methods in C#, Is there any point left in keeping overloads in implementation of any class for passing default values?
Why pollute the class implementation when overloads can be made extension methods?
Any advantage of overloads (for passing default values)?
I’m counting out the option of default parameters because it forces specific ordering of parameters (i.e. default ones can come in end) and the fact that default value gets compiled in client code and a service pack could possibly break because of that.
I would use optional arguments instead of extension methods to remove overloads.
Extension methods have quite a few disadvantages – they have less access to the private members, they have a discoverability issue (as they’re defined on a separate class), etc.
However, there are times when using overloaded methods and constructors are better than adding optional arguments – separate from the issues you already mentioned. This include: