ISessionStateItemCollection.RemoveAt(Int32) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクション内の指定したインデックス位置の項目を削除します。
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必要があります。