ISessionStateItemCollection.RemoveAt(Int32) メソッド

定義

コレクション内の指定したインデックス位置の項目を削除します。

public:
 void RemoveAt(int index);
public void RemoveAt (int index);
abstract member RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

パラメーター

index
Int32

コレクションから削除する項目のインデックス。

RemoveAt メソッドを実装する方法を次のコード例に示します。 インターフェイスの完全な実装の ISessionStateItemCollection 例については、インターフェイスの概要に記載されている例を ISessionStateItemCollection 参照してください。

public void RemoveAt(int index)
{
  if (index < 0 || index >= this.Count)
    throw new ArgumentOutOfRangeException("The specified index is not within the acceptable range.");

  pItems.RemoveAt(index);
  pDirty = true;
}
 Public Sub RemoveAt(index As Integer) Implements ISessionStateItemCollection.RemoveAt 
   If index < 0 OrElse index >= Me.Count Then _
     Throw New ArgumentOutOfRangeException("The specified index is not within the acceptable range.")

   pItems.RemoveAt(index)
   pDirty = True
 End Sub

注釈

メソッドを RemoveAt 実装する場合は、実装内の値が Dirty 変更されたことを示すようにプロパティ true を設定する ISessionStateItemCollection 必要があります。

メソッドのRemoveAt実装では、0 未満または次の値以上の場合indexに例外をスローArgumentOutOfRangeExceptionするICollection.Count必要があります。

適用対象

こちらもご覧ください