public ClassType(string type) {
Type = type;
}
public ClassType(string type,bool isArray=false) {
Type = type;
IsArray = isArray;
}
ClassType ct = new ClassType("adsf");
Which constructor is chosen?
public ClassType(string type) {
Type = type;
}
public ClassType(string type,bool isArray=false) {
Type = type;
IsArray = isArray;
}
ClassType ct = new ClassType("adsf");
Which constructor is chosen?
The overload that doesn't require an optional parameter. Note that it's just a "yes" or "no" decision here: "no optional parameters filled in automatically" is preferable to "some optional parameters filled in automatically" but there's no preference between 1 or 2 being filled in. (That would be ambiguous.)
From section 7.5.3.2 of the C# 4 spec:
Otherwise if all parameters of MP have a corresponding argument whereas default arguments need to be substituted for at least one optional parameter in MQ then MP is better than MQ.