private int GetIndexCodeForQuestion() { List <int> lCode = SqlRequestFunction.GetListQuestionCode(); int count = lCode.Count; for (int index = 0; index < count; index++) { int expectValue = index + 1; if (expectValue != lCode[index]) { return(expectValue); } } return(lCode[count - 1] + 1); }