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

                return(_array[_offset + index]);
            }
        }
Example #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));
            }
        }
Example #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]);
            }
        }
Example #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;
            }
        }