예제 #1
0
 public T this[int index]
 {
     get
     {
         Invariant.ArgumentIsInRange <int>(index, "index", new Range <int>(0, this.Count - 1));
         return(this.items[index]);
     }
 }
예제 #2
0
 T IList <T> .this[int index]
 {
     get
     {
         Invariant.ArgumentIsInRange <int>(index, "index", new Range <int>(0, this.Count - 1));
         return(this[index]);
     }
     set
     {
         throw new NotSupportedException();
     }
 }
예제 #3
0
        public static void InsertRange <TItem>(this IList <TItem> self, int index, IEnumerable <TItem> items)
        {
            Invariant.ArgumentIsInRange <int>(index, "index", new Range <int>(0, self.Count));
            List <TItem> objList = self as List <TItem>;

            if (objList != null)
            {
                objList.InsertRange(index, items);
            }
            else
            {
                foreach (TItem obj in items)
                {
                    self.Insert(index++, obj);
                }
            }
        }
예제 #4
0
 public void RemoveAt(int index)
 {
     Invariant.ArgumentIsInRange <int>(index, "index", new Range <int>(0, this.Count - 1));
     this.items.RemoveAt(index);
 }