Example #1
0
        //implementation for KeyCollection and ValueCollection copyTo method
        private void CopyToCollection(Array array, int index, EnumeratorType type)
        {
            if (index < 0 && index > _numberOfBuckets)
            {
                throw new IndexOutOfRangeException("index");
            }

            int j   = 0;
            int len = array.Length;

            for (int i = index; i < _numberOfBuckets; i++)
            {
                for (Entry cur = _buckets[i]; cur != null && j < len; cur = cur.next)
                {
                    if (type == EnumeratorType.KEY)
                    {
                        ((IList)array)[j] = cur.key;
                    }
                    else
                    {
                        ((IList)array)[j] = cur.value;
                    }

                    j++;
                }
            }
        }
 internal XSOEnumerator(List <XmlSchemaObjectEntry> entries, int size, EnumeratorType enumType)
 {
     _entries     = entries;
     this.size    = size;
     _enumType    = enumType;
     currentIndex = -1;
 }
Example #3
0
        //implementation for KeyCollection and ValueCollection copyTo method
        private void CopyToCollection(Array array, int index, EnumeratorType type)
        {
            if (index < 0 && index > _numberOfBuckets)
            {
#pragma warning disable S112 // General exceptions should never be thrown
                throw new IndexOutOfRangeException("index");
#pragma warning restore S112 // General exceptions should never be thrown
            }

            for (int i = index; i < _numberOfBuckets; i++)
            {
                var j = 0;

                for (Entry cur = _buckets[i]; cur != null && j < array.Length; cur = cur.next)
                {
                    if (type == EnumeratorType.KEY)
                    {
                        ((IList)array)[j] = cur.key;
                    }
                    else
                    {
                        ((IList)array)[j] = cur.value;
                    }

                    j++;
                }
            }
        }
Example #4
0
 // Methods
 internal NameValueEnumerator(TStringList coll, EnumeratorType type)
 {
     _coll           = coll;
     _type           = type;
     _versionChecker = _coll.GetBaseEnumerator();
     _pos            = -1;
 }
 internal Enumerator(List <IProperty <TContainer> > .Enumerator properties)
 {
     m_Type       = EnumeratorType.List;
     m_Enumerator = default;
     m_Properties = properties;
     Current      = default;
 }
 /// <summary>
 /// Passthrough enumerator.
 /// </summary>
 /// <param name="enumerator"></param>
 internal Enumerator(IEnumerator <IProperty <TContainer> > enumerator)
 {
     m_Type       = EnumeratorType.Enumerable;
     m_Enumerator = enumerator;
     m_Properties = default;
     Current      = default;
 }
            public EnumerationData(Type itemType)
            {
                EnumerableType = typeof(IEnumerable <>).MakeGenericType(itemType);
                EnumeratorType = typeof(IEnumerator <>).MakeGenericType(itemType);

                GetEnumerator = EnumerableType.GetMethod("GetEnumerator", new Type[0]);
                Current       = EnumeratorType.GetProperty("Current");
            }
Example #8
0
 internal Enumerator(PlayQueue queue, EnumeratorType type = EnumeratorType.All)
 {
     _queue   = queue;
     _type    = type;
     _state   = 0;
     _index   = 0;
     _version = _queue._version;
     _current = null;
 }
        private GenericCollectionInfo(Type collectionType, Type elementType, ConstructorInfo constructor)
        {
            CollectionType = collectionType;
            ElementType    = elementType;
            Constructor    = constructor;

            _countPropertyLazy       = new Lazy <MethodInfo>(() => CollectionType.GetProperty("Count").GetMethod);
            _addMethodLazy           = new Lazy <MethodInfo>(() => CollectionType.GetMethod("Add", new Type[] { elementType }));
            _getEnumeratorMethodLazy = new Lazy <MethodInfo>(() => CollectionType.GetMethod("GetEnumerator"));

            _enumeratorMoveNextMethodLazy  = new Lazy <MethodInfo>(() => EnumeratorType.GetMethod("MoveNext"));
            _enumeratorCurrentPropertyLazy = new Lazy <MethodInfo>(() => EnumeratorType.GetProperty("Current").GetMethod);
        }
 internal XSODictionaryEnumerator(List <XmlSchemaObjectEntry> entries, int size, EnumeratorType enumType) : base(entries, size, enumType)
 {
 }
Example #11
0
 public HashtableEnumerator(Hashtable hashtable, EnumeratorType type)
 {
     ht = hashtable;
     returnType = type;
 }
Example #12
0
 internal SubQueue(PlayQueue queue, EnumeratorType type)
 {
     _queue = queue;
     _type  = type;
 }
Example #13
0
 public HashtableEnumerator(Hashtable hashtable, EnumeratorType type)
 {
     ht         = hashtable;
     returnType = type;
 }
Example #14
0
        //implementation for KeyCollection and ValueCollection copyTo method
        private void CopyToCollection(Array array, int index, EnumeratorType type)
        {
            if (index < 0 && index > _numberOfBuckets)
                throw new IndexOutOfRangeException("index");

            int j = 0;
            int len = array.Length;
            
            for (int i = index; i < _numberOfBuckets; i++)
            {
                for (Entry cur = _buckets[i]; cur != null && j < len; cur = cur.next)
                {
                    if (type == EnumeratorType.KEY)
                        ((IList)array)[j] = cur.key;
                    else
                        ((IList)array)[j] = cur.value;

                    j++;
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyCollection{TContainer}"/> struct which wraps the given enumerable.
 /// </summary>
 /// <param name="enumerable">An <see cref="IEnumerable"/> of properties to wrap.</param>
 public PropertyCollection(IEnumerable <IProperty <TContainer> > enumerable)
 {
     m_Type       = EnumeratorType.Enumerable;
     m_Enumerable = enumerable;
     m_Properties = null;
 }
 internal XSODictionaryEnumerator(List<XmlSchemaObjectEntry> entries, int size, EnumeratorType enumType) : base(entries, size, enumType) {
 }
 internal XSOEnumerator(List<XmlSchemaObjectEntry> entries, int size, EnumeratorType enumType) {
     this.entries = entries;
     this.size = size;
     this.enumType = enumType;
     currentIndex = -1;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyCollection{TContainer}"/> struct which wraps the given properties list.
 /// </summary>
 /// <param name="properties">A list of properties to wrap.</param>
 public PropertyCollection(List <IProperty <TContainer> > properties)
 {
     m_Type       = EnumeratorType.List;
     m_Enumerable = null;
     m_Properties = properties;
 }
Example #19
0
 internal NameValueCollectionBase(TStringList coll, EnumeratorType type)
 {
     _coll = coll;
     _type = type;
 }