Using c# 4.0 -- building an interface and a class that implements the interface. I want to declare an optional parameter in the interface and have it be reflected in the class. So, I have the following:
public interface IFoo
{
void Bar(int i, int j=0);
}
public class Foo
{
void Bar(int i, int j=0) { // do stuff }
}
This compiles, but it doesn't look right. The interface needs to have the optional parameters, because otherwise it doesn't reflect correctly in the interface method signature.
Should I skip the optional parameter and just use a nullable type? Or will this work as intended with no side effects or consequences?