Share via


ISessionStateItemCollection.RemoveAt(Int32) Método

Definición

Elimina un elemento que se encuentra en el índice especificado de la colección.

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

Parámetros

index
Int32

Índice del elemento que se va a quitar de la colección.

Ejemplos

En el siguiente ejemplo de código se muestra la implementación del método RemoveAt. Para obtener un ejemplo de una implementación completa de la ISessionStateItemCollection interfaz, consulte el ejemplo proporcionado en la información general de la ISessionStateItemCollection interfaz.

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

Comentarios

Al implementar el RemoveAt método , debe establecer la Dirty propiedad en true para indicar que se han modificado los valores de la ISessionStateItemCollection implementación.

La implementación del RemoveAt método debe producir una ArgumentOutOfRangeException excepción si index es menor que cero o es igual o mayor que ICollection.Count.

Se aplica a

Consulte también