Пример #1
0
 public void Reset()
 {
     // Reset enumeration over the cached single page
     _currentEnumerateSelector = ArraySelector.All(_currentPageCount).Slice(0, 0);
 }
Пример #2
0
        /// <summary>
        ///  Build an XArray referring to [0, Count) in the array with the optional given null array.
        /// </summary>
        /// <param name="array">Array containing values</param>
        /// <param name="count">Count of valid Array values</param>
        /// <param name="nulls">bool[] true for rows which have a null value</param>
        /// <param name="isSingle">True for IsSingleValue arrays, False otherwise</param>
        /// <returns>XArray wrapping the array from [0, Count)</returns>
        public static XArray All(Array array, int count = -1, bool[] nulls = null, bool isSingle = false)
        {
            if (array == null)
            {
                if (count == 0 || count == -1)
                {
                    return(XArray.Empty);
                }
                throw new ArgumentNullException("array");
            }

            if (count == -1)
            {
                count = array.Length;
            }
            if (isSingle == false && count > array.Length)
            {
                throw new ArgumentOutOfRangeException("length");
            }
            if (isSingle == false && nulls != null && count > nulls.Length)
            {
                throw new ArgumentOutOfRangeException("length");
            }

            return(new XArray()
            {
                Array = array, NullRows = nulls, Selector = (isSingle ? ArraySelector.Single(count) : ArraySelector.All(count))
            });
        }