I have the following code:
public static MyMethod()
{
...Do something
ProtectedMethod(param1, param2);
...Do something
}
protected stati
Hoping to help others with what I find as being a more elegant implementation of overloading mixed with the (delegate-oriented) strategy pattern.
public class OverloadExample {
private Action _implementation;
public OverloadExample() {
_implementation = defaultImplementation;
}
public OverloadExample(Action implementation) {
_implementation = implementation;
}
protected void defaultImplementation(int aInt, bool aBool) {
//
}
public void Implementation(int someInt, bool someBool = true) {
_implementation(someInt, someBool);
}
}
Usage:
new OverloadExample().Implementation(9001);
new OverloadExample().Implementation(9001, false);