语言

ServiceDescriptionCollection.Insert(Int32, ServiceDescription) 方法

定义

将指定的 ServiceDescription 实例添加到 ServiceDescriptionCollection 从零开始的指定索引处。

public:
 void Insert(int index, System::Web::Services::Description::ServiceDescription ^ serviceDescription);
public void Insert(int index, System.Web.Services.Description.ServiceDescription serviceDescription);
member this.Insert : int * System.Web.Services.Description.ServiceDescription -> unit
Public Sub Insert (index As Integer, serviceDescription As ServiceDescription)

参数

index
Int32

要插入参数的从零开始的 serviceDescription 索引。

serviceDescription
ServiceDescription

ServiceDescription要添加到集合中。

例外

参数 index 小于零。

-或-

参数 index 大于 Count.

示例

// Insert a ServiceDescription into the collection.
myCollection->Insert( 1, myServiceDescription2 );
// Insert a 'ServiceDescription' object into the collection.
myCollection.Insert(1, myServiceDescription2);
' Insert a 'ServiceDescription' object into the collection.
myCollection.Insert(1, myServiceDescription2)

注解

如果集合中的项数已等于集合的容量,则插入新元素之前,通过自动重新分配内部数组来增加容量。

index如果参数等于Count,则参数serviceDescription将添加到该ServiceDescriptionCollection参数的末尾。

插入点下移以容纳新元素的元素。

适用于