StringCollection.IList.Insert(Int32, Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将元素 StringCollection 插入指定索引处。
virtual void System.Collections.IList.Insert(int index, System::Object ^ value) = System::Collections::IList::Insert;
void IList.Insert(int index, object value);
void IList.Insert(int index, object? value);
abstract member System.Collections.IList.Insert : int * obj -> unit
override this.System.Collections.IList.Insert : int * obj -> unit
Sub Insert (index As Integer, value As Object) Implements IList.Insert
参数
- index
- Int32
应插入的从零开始 value 的索引。
实现
例外
注解
如果 Count 已等于容量,则通过自动重新分配内部数组来增加容量 StringCollection ,并在添加新元素之前将现有元素复制到新数组。
如果 index 等于 Count, value 则添加到末尾 StringCollection。
在连续元素(如列表)的集合中,插入点后面的元素向下移动以适应新元素。 如果为集合编制索引,则移动的元素的索引也会更新。 此行为不适用于在概念上将元素分组到存储桶中的集合,例如哈希表。
此方法是 O(n) 操作,其中 n 。Count