private bool SetParameterCount(int numberOfParameters) { Overload = AllOverloads .OrderBy(o => Math.Abs(numberOfParameters - o.Parameters.Length)) .FirstOrDefault(); CurrentOptions = CurrentOptions .Where(o => numberOfParameters <= o.Parameters.Length) .ToList(); if (CurrentOptions.Count == 0) { parseInfo.Script.Diagnostics.Error( string.Format(ErrorMessages.BadParameterCount, numberOfParameters), genericErrorRange ); return(false); } return(true); }