コード例 #1
0
        /// <summary>
        /// Determines whether the <see cref="BigArray{T}"/> contains elements that match the conditions defined by the specified predicate.
        /// </summary>
        /// <param name="match">The Predicate{T} delegate that defines the conditions of the elements to search for.</param>
        /// <returns>True if the <see cref="BigArray{T}"/> contains one or more elements that match the conditions defined by the specified predicate; otherwise false.</returns>
        public bool Exists(Predicate <T> match)
        {
            //This value was approximately estimated by practical way
            const int borderCountToSwitchMode = 10000000;

            if (Count < borderCountToSwitchMode)
            {
                return(_blockCollection.Any(block => block.Exists(match)));
            }
            else
            {
                return(_blockCollection.AsParallel().Any(block => block.Exists(match)));
            }
        }