/// <summary> /// Searches for an element that matches the conditions defined by the specified predicate, /// and returns the zero-based index of the first occurrence within the range of elements in the <see cref="BigArray{T}"/> /// that starts at the specified index and contains the specified number of elements. /// </summary> /// <param name="index">The zero-based starting index of the search.</param> /// <param name="count">The number of elements in the section to search.</param> /// <param name="match">The Predicate(T) delegate that defines the conditions of the element to search for.</param> /// <returns>The zero-based index of the first occurrence of an element that matches the conditions defined by match, /// if found; otherwise, –1. </returns> public int FindIndex(int index, int count, Predicate <T> match) { if (match == null) { throw new ArgumentNullException("match"); } var multyblockRange = _arrayMap.MultyblockRange(new Range(index, count)); int indexOfBlock = multyblockRange.IndexOfStartBlock; foreach (var blockRange in multyblockRange.Ranges) { int findIndexResult = _blockCollection[indexOfBlock++] .FindIndex(blockRange.Subindex, blockRange.Count, match); if (findIndexResult != -1) { return(blockRange.CommonStartIndex + findIndexResult); } } //If there is no needed value return(-1); }