Exemple #1
0
        public void ForEach(Action <T> action)
        {
            if (action == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.action);
            }
            Contract.EndContractBlock();

            int version = _version;

            for (int i = 0; i < _size; i++)
            {
                if (version != _version)
                {
                    break;
                }
                // ReSharper disable once PossibleNullReferenceException
                action(_items[i]);
            }

            if (version != _version)
            {
                ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
            }
        }
Exemple #2
0
            void System.Collections.IEnumerator.Reset()
            {
                if (version != refList._version)
                {
                    ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
                }

                index   = 0;
                current = default(T);
            }
Exemple #3
0
            private bool MoveNextRare()
            {
                if (version != refList._version)
                {
                    ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
                }

                index   = refList._size + 1;
                current = default(T);
                return(false);
            }