private int MoreSpecific(Candidate c1, Candidate c2)
{
int result = 0;
for (int i = 0; i < _arguments.Count && i < c1.Parameters.Length; ++i)
{
if (c1.ArgumentScores[i] <= DowncastScore) continue;
// Select the most specific of the parameters' types,
// taking into account generic mapped parameters
int better = MoreSpecific(
GetParameterTypeTemplate(c1, i),
GetParameterTypeTemplate(c2, i));
// Skip parameters that are the same for both candidates
if (better == 0)
{
continue;
}
// Keep the first result that is not a tie
if (result == 0)
{
result = better;
}
// If a further result contradicts the initial result, neither candidate is more specific
else if (result != better)
{
return 0;
}
}
return result;
}