public int FetchNextIndex() { int canidate = _curValue; // assign a new curValue while(IndexList.Gaps.Contains(canidate)) { canidate--; } int result = canidate; _curValue = canidate - 1; // save next value ;) return result; }