/// <summary> /// Removes the first occurrence of a specific object from the <see cref="BigArray{T}"/>. /// </summary> /// <param name="item">The object to remove from the <see cref="BigArray{T}"/>. /// The value can be null for reference types.</param> /// <returns>True if item is successfully removed; otherwise, false. /// This method also returns false if item was not found in the <see cref="BigArray{T}"/>.</returns> public bool Remove(T item) { for (int i = 0; i < _blockCollection.Count; i++) { var block = _blockCollection[i]; int blockIndexOf = block.IndexOf(item); //If there is value in this block if (blockIndexOf != -1) { block.Remove(item); //If there is empty block - remove it if (block.Count == 0) { _blockCollection.RemoveAt(i); _arrayMap.DataChangedAfterBlockRemoving(i); } else { _arrayMap.DataChanged(i); } Count--; return(true); } } //If there is not value in this distributed array return(false); }