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

                if (version == localList._version && ((uint)index < (uint)localList._size))
                {
                    current = localList._items[index];
                    index++;
                    return(true);
                }
                return(MoveNextRare());
            }
示例#3
0
        public Net40List <T> FindAll(Predicate <T> match)
        {
            if (match == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
            }

            Net40List <T> list = new Net40List <T>();

            for (int i = 0; i < _size; i++)
            {
                if (match(_items[i]))
                {
                    list.Add(_items[i]);
                }
            }
            return(list);
        }
示例#4
0
        public Net40List <TOutput> ConvertAll <TOutput>(Converter <T, TOutput> converter)
        {
            if (converter == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.converter);
            }
            // @



            Net40List <TOutput> list = new Net40List <TOutput>(_size);

            for (int i = 0; i < _size; i++)
            {
                list._items[i] = converter(_items[i]);
            }
            list._size = _size;
            return(list);
        }
示例#5
0
        public Net40List <T> GetRange(int index, int count)
        {
            if (index < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
            }

            if (count < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
            }

            if (_size - index < count)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
            }

            Net40List <T> list = new Net40List <T>(count);

            Array.Copy(_items, index, list._items, 0, count);
            list._size = count;
            return(list);
        }
示例#6
0
 internal SynchronizedList(Net40List <T> list)
 {
     _list = list;
     _root = ((System.Collections.ICollection)list).SyncRoot;
 }
示例#7
0
 internal static IList <T> Synchronized(Net40List <T> list)
 {
     return(new SynchronizedList(list));
 }