예제 #1
0
        /// <summary>
        /// Gets the value of the specified element in the current Array.
        /// </summary>
        /// <param name="index">
        /// An integer that represents the position of the Array element to
        /// get.
        /// </param>
        /// <returns>
        /// The value at the specified position in the Array.
        /// </returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// index is outside the range of valid indexes for the current Array.
        /// </exception>
        public object GetValue(int index)
        {
            // Preconditions.
            if (index < 0 || index >= Length)
            {
                throw new ArgumentOutOfRangeException(
                          "Index out of range.");
            }

            return(head.GetValue(index));
        }
예제 #2
0
        /// <summary>
        /// Gets the value at the specified position in the current
        /// RandomAccessList.
        /// </summary>
        /// <param name="index">
        /// An integer that represents the position of the RandomAccessList
        /// element to get.
        /// </param>
        /// <returns>
        /// The value at the specified position in the RandomAccessList.
        /// </returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// index is outside the range of valid indexes for the current
        /// RandomAccessList.
        /// </exception>
        public object GetValue(int index)
        {
            // Precondition.
            if (index < 0 || index >= Count)
            {
                throw new ArgumentOutOfRangeException("index", index,
                                                      "Index out of range.");
            }

            return(first.GetValue(index));
        }