Metodo Remove (MobileListItemCollection)

Rimuove l'elemento con il valore specificato.

public void Remove(
   String item
)

Parametri

  • item
    Il valore dell'elemento da rimuovere. Il primo elemento corrispondente a questo valore nell'insieme viene rimosso.

Esempio

Nell'esempio seguente viene mostrato come utilizzare il metodo Remove per rimuovere un elemento dall'insieme MobileListItemCollection.

Sub Button_Click(sender As Object, e As EventArgs)
   
   Dim _ml As New MobileListItem("text", "value")
   ' Add a MobileListItem item if it's not present.
   
   If Not SelectionList1.Items.Contains(_ml) Then
      SelectionList1.Items.Add(_ml)
   
   Else
      'Remove the item if it's present in the list.
      SelectionList1.Items.Remove(_ml)
   
   End If

End Sub

[C#]

void Button_Click(Object sender, EventArgs e)
{
   MobileListItem _ml = new MobileListItem("text", "value");
   // Add a MobileListItem item if it's not present.
   if(!SelectionList1.Items.Contains(_ml))
   {
      SelectionList1.Items.Add(_ml);  
   }
   else
   {
   //Remove the item if it's present in the list.
      SelectionList1.Items.Remove(_ml);
   }
}

Vedere anche

Metodo Remove (DeviceSpecificChoiceCollection) | Metodo Remove (ObjectListCommandCollection) | Metodo Remove (ObjectListFieldCollection) | Metodo Remove (StyleSheet)

Si applica a: classe MobileListItemCollection