BindingList<T>.InsertItem(Int32, T) 方法

定义

将指定的项插入到列表中的指定索引位置。Inserts the specified item in the list at the specified index.

protected:
 override void InsertItem(int index, T item);
protected override void InsertItem (int index, T item);
override this.InsertItem : int * 'T -> unit
Protected Overrides Sub InsertItem (index As Integer, item As T)

参数

index
Int32

要插入该项的位置的从零开始的索引。The zero-based index where the item is to be inserted.

item
T

要插入列表的项。The item to insert in the list.

注解

InsertItem 执行以下操作:InsertItem performs the following operations:

  • 调用 EndNew 来提交通过 AddingNew 事件添加的任何未提交的项。Calls EndNew to commit any uncommitted items added through the AddingNew event.

  • 在指定索引处插入项Inserts the item at the specified index

  • 引发 ItemAdded 类型的 ListChanged 事件,该事件指示已插入项的索引。Raises a ListChanged event of type ItemAdded indicating the index of the item that was inserted.

适用于