public static int FindClosestStablePoint(int pos, IntPairCollection positions) { foreach (IntPair pair in positions) { if ((pos == pair.Key + 1) || (pos == pair.Key - 1)) { return(pair.Key); } } return(pos); }
public static int FindClosestStablePoint(int pos, IntPairCollection positions) { foreach (IntPair pair in positions) { if ((pos == pair.Key + 1) || (pos == pair.Key - 1)) return pair.Key; } return pos; }