Microsoft.Cci.PrimarySourceDocument.FindBestStartPointForLine C# (CSharp) Method

FindBestStartPointForLine() private method

From the set of stored states for position/(line,column) conversion, find the one that is closest to line.
private FindBestStartPointForLine ( int line ) : int
line int
return int
    private int FindBestStartPointForLine(int line) {
      int best = 0;
      int bestDistance = int.MaxValue;

      for (int i = 0; i < lineCounters.Length; i++) {
        int distance = Math.Abs(lineCounters[i] - line);
        if (distance < bestDistance) {
          bestDistance = distance;
          best = i;
        }
      }

      return best;
    }