ISessionStateItemCollection.RemoveAt(Int32) Metoda

Definicja

Usuwa element w określonym indeksie z kolekcji.

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

Parametry

index
Int32

Indeks elementu do usunięcia z kolekcji.

Przykłady

Poniższy przykład kodu przedstawia implementację RemoveAt metody . Aby zapoznać się z przykładem pełnej implementacji interfejsu ISessionStateItemCollection , zobacz przykład podany w omówieniu interfejsu 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

Uwagi

W implementacji RemoveAt metody należy ustawić Dirty właściwość , aby wskazać true wartości w ISessionStateItemCollection implementacji zostały zmodyfikowane.

Implementacja RemoveAt metody powinna zgłosić ArgumentOutOfRangeException wyjątek, jeśli index wartość jest mniejsza niż zero lub jest równa lub większa niż ICollection.Count.

Dotyczy

Zobacz też