Partager via


RemoveAt, méthode (Common)

Supprime l'élément au niveau de l'index spécifié.

public void RemoveAt(
   int index
)

Paramètres

  • index
    Numéro d'index de l'élément à supprimer.

Exemple

L'exemple suivant montre comment utiliser la méthode RemoveAt pour supprimer un élément de ObjectListCommandCollection.

Sub ShowTaskDetail(sender As [Object], e As ObjectListSelectEventArgs)
   'Check conditions to Add or remove Commands in detailview
   If ObjectList1.Selection("Flag").Equals("No") Then
      
      ObjectList1.Commands.RemoveAt(1)
   
    End If
   If ObjectList1.Selection("Name").Equals("Name1") Then
      
      ObjectList1.Commands.RemoveAt(0)
   
    End If
End Sub 

[C#]

void ShowTaskDetail(Object sender, ObjectListSelectEventArgs e)
{
   //Check conditions to Add or remove Commands in detailview
   if(ObjectList1.Selection["Flag"].Equals("No"))
   {
      ObjectList1.Commands.RemoveAt(1);
   }
   if(ObjectList1.Selection["Name"].Equals("Name1"))
   {
      ObjectList1.Commands.RemoveAt(0);
   }
}

Voir aussi

S'applique à : DeviceSpecificChoiceCollection, classe | MobileListItemCollection, classe