指定した 0 から始まるインデックス番号にある OperationCollection に、指定した Operation を追加します。
Public Sub Insert( _
ByVal index As Integer, _ ByVal operation As Operation _)
[C#]
public void Insert(intindex,Operationoperation);
[C++]
public: void Insert(intindex,Operation* operation);
[JScript]
public function Insert(
index : int,operation : Operation);
パラメータ
- index
operation パラメータを挿入する位置の、0 から始まるインデックス番号。 - operation
コレクションに追加する Operation 。
解説
コレクション内の項目数が既にコレクションの許容量に達している場合は、新しい要素が挿入される前に内部配列が自動的に再割り当てされ、コレクションの容量が 2 倍になります。
index パラメータと Count が等しい場合は、 operation パラメータが OperationCollection の末尾に追加されます。
新しい要素を挿入できるように、挿入位置より後にある要素の位置が繰り下がります。
使用例
[Visual Basic, C#, C++] Insert メソッドを使用する例を次に示します。
myOperationCollection.Remove(myOperation)
' Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation)
Console.WriteLine("The operation at index '0' is : " + _
myOperationCollection.Item(0).Name)
[C#]
myOperationCollection.Remove(myOperation);
// Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation);
Console.WriteLine("The operation at index '0' is : " +
myOperationCollection[0].Name);
[C++]
myOperationCollection->Remove(myOperation);
// Insert the 'myOpearation' operation at the index '0'.
myOperationCollection->Insert(0, myOperation);
Console::WriteLine(S"The operation at index '0' is : {0}", myOperationCollection->Item[0]->Name);
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
OperationCollection クラス | OperationCollection メンバ | System.Web.Services.Description 名前空間