private static List<int> getChainReferences(RowNoHeader row) { var result = new List<int>(); var nextChainRefPos = row.FindIndex(LinkedChainsStartCell, LinkedChainsCellCount, isVluableCell); while (nextChainRefPos != -1) { result.Add(nextChainRefPos); nextChainRefPos = row.FindIndex(nextChainRefPos + 1, LinkedChainsCellCount - (nextChainRefPos - LinkedChainsStartCell + 1), isVluableCell); } return result.Select(i => i - LinkedChainsStartCell).ToList(); }