public bool MoveNext()
            {
                if (_version != _dictionary._version)
                {
                    CollectionExceptions.InvalidOperation_EnumerationFailedVersion();
                }

                // Use unsigned comparison since we set index to dictionary.count+1 when the enumeration ends.
                // dictionary.count+1 could be negative if dictionary.count is int.MaxValue
                while ((uint)_index < (uint)_dictionary._count)
                {
                    ref Entry entry = ref _dictionary._entries ![_index++];
Esempio n. 2
0
            public void CopyTo(TValue[] array, int index)
            {
                if (array == null)
                {
                    throw new ArgumentNullException(nameof(array));
                }

                if ((uint)index > array.Length)
                {
                    throw new ArgumentOutOfRangeException(nameof(index));
                }

                if (array.Length - index < _dictionary.Count)
                {
                    throw CollectionExceptions.Argument_ArrayPlusOffTooSmall();
                }

                int count = _dictionary._count;

                Entry[]? entries = _dictionary._entries;
                for (int i = 0; i < count; i++)
                {
                    if (entries ![i].Next >= -1)