Example #1
0
 internal Enumerator(Rist <T> list)
 {
     _list    = list;
     _index   = 0;
     _version = list._version;
     _current = default;
 }
Example #2
0
            public bool MoveNext()
            {
                Rist <T> localList = _list;

                if (_version == localList._version && ((uint)_index < (uint)localList._size))
                {
                    _current = localList._items[_index];
                    _index++;
                    return(true);
                }
                return(MoveNextRare());
            }
Example #3
0
        /// <summary>
        /// Extracts the internal array and replaces it with a zero length array.
        /// </summary>
        /// <param name="rist">The <see cref="Rist{T}"/> from which to extract the array.</param>
        /// <param name="segment">When this method returns,
        /// contains the array segment retrieved from the underlying internal array.
        /// </param>
        public static void MoveToArray <T>(this Rist <T> rist, out ArraySegment <T> segment)
        {
            if (rist is null)
            {
                throw new ArgumentNullException(nameof(rist));
            }

            int length = rist._size;

            T[] array = rist.MoveToArray();
            segment = new ArraySegment <T>(array, 0, length);
        }