public IEntity ResolveCallableReference(ExpressionCollection args, IEntity[] candidates)
{
Reset(args, candidates);
InferGenericMethods();
FindApplicableCandidates();
if (ValidCandidates.Count == 0) return null;
if (ValidCandidates.Count == 1) return (ValidCandidates[0]).Method;
List<Candidate> dataPreserving = FindDataPreservingCandidates();
if (dataPreserving.Count > 0)
{
FindBestMethod(dataPreserving);
if (dataPreserving.Count == 1) return (dataPreserving[0]).Method;
}
FindBestMethod(_candidates);
if (ValidCandidates.Count == 1) return (ValidCandidates[0].Method);
return null;
}