コード例 #1
0
ファイル: Core.cs プロジェクト: stjordanis/Imms
        /// <summary>
        ///     Removes the element at some index from the list.
        /// </summary>
        /// <param name="index"> The index to remove. </param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown if the index does not exist in the list.</exception>
        /// <returns> </returns>
        public ImmList <T> RemoveAt(int index)
        {
            index.CheckIsBetween("index", -Root.Measure, Root.Measure - 1);
            index = index < 0 ? index + Root.Measure : index;
            var ret = Root.RemoveAt(index, Lineage.Mutable()).Wrap();

#if ASSERTS
            if (Root.Measure > index + 1)
            {
                ret[index].AssertEqual(this[index + 1]);
            }
            ret.Root.Measure.AssertEqual(Root.Measure - 1);
#endif
            return(ret);
        }