I had a method like this that its consumers are calling it:
static public void DisplayOrderComments(param1, param2, param3, param4)
Now I added an overload for it like this:
static public void DisplayOrderComments(param1, param2, param3, param4, param5)
{
DisplayOrderComments(param1, param2, param3, param4);
param5.Foo();
}
Is it a bad practice? Are there better ways of doing it?
This is absolutely fine – it keeps code DRY and avoids unnecessary duplication.
Not only is it not a bad practice, it is a good practice.
If you are using C# 4.0 and above (VS 2010+), you can use an optional argument for your
param5instead of overloading, as Mikey Mouse mentions in this answer.