Beispiel #1
0
 internal Enumerator(ReferenceEqualityList <T> list)
 {
     this.list = list;
     index     = 0;
     version   = list._version;
     current   = default(T);
 }
Beispiel #2
0
            public bool MoveNext()
            {
                ReferenceEqualityList <T> localList = list;

                if (version == localList._version && ((uint)index < (uint)localList._size))
                {
                    current = localList._items[index];
                    index++;
                    return(true);
                }
                return(MoveNextRare());
            }
Beispiel #3
0
        public ReferenceEqualityList <TOutput> ConvertAll <TOutput>(Converter <T, TOutput> converter)
        {
            if (converter is null)
            {
                throw new ArgumentNullException("converter");
            }
            // @


            var list = new ReferenceEqualityList <TOutput>(_size);

            for (int i = 0; i < _size; i++)
            {
                list._items[i] = converter(_items[i]);
            }
            list._size = _size;
            return(list);
        }
Beispiel #4
0
        public ReferenceEqualityList <T> GetRange(int index, int count)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count");
            }

            if (_size - index < count)
            {
                throw new ArgumentException();
            }

            var list = new ReferenceEqualityList <T>(count);

            Array.Copy(_items, index, list._items, 0, count);
            list._size = count;
            return(list);
        }
Beispiel #5
0
 internal SynchronizedList(ReferenceEqualityList <T> list)
 {
     _list = list;
     _root = ((ICollection)list).SyncRoot;
 }
Beispiel #6
0
 internal static IList <T> Synchronized(ReferenceEqualityList <T> list)
 {
     return(new SynchronizedList(list));
 }