Exemplo n.º 1
0
        T IReadOnlyList <T> .this[int index]
        {
            get
            {
                ThrowInvalidOperationIfDefault();
                if (index < 0 || index >= _count)
                {
                    ThrowHelper.ThrowArgumentOutOfRange_IndexException();
                }

                return(_array[_offset + index]);
            }
        }
Exemplo n.º 2
0
        public Char8 this[int index]
        {
            get
            {
                // Just like String, we don't allow indexing into the null terminator itself.

                if ((uint)index >= (uint)Length)
                {
                    ThrowHelper.ThrowArgumentOutOfRange_IndexException();
                }

                return(Unsafe.Add(ref DangerousGetMutableReference(), index));
            }
        }
Exemplo n.º 3
0
        T IReadOnlyList <T> .this[int index]
        {
            get
            {
                if (_array == null)
                {
                    ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_NullArray);
                }
                if (index < 0 || index >= _count)
                {
                    ThrowHelper.ThrowArgumentOutOfRange_IndexException();
                }
                Contract.EndContractBlock();

                return(_array[_offset + index]);
            }
        }
Exemplo n.º 4
0
        public T this[int index]
        {
            get
            {
                if ((uint)index >= (uint)_count)
                {
                    ThrowHelper.ThrowArgumentOutOfRange_IndexException();
                }

                return(_array[_offset + index]);
            }
            set
            {
                if ((uint)index >= (uint)_count)
                {
                    ThrowHelper.ThrowArgumentOutOfRange_IndexException();
                }

                _array[_offset + index] = value;
            }
        }