Share via


Clear Method (Common)

Clears the collection.

public void Clear()

Remarks

This method is not available in the read-only IObjectListFieldCollection interface.

You can use the Clear method for all the classes where this method applies. For example, the Clear method for a StyleSheet collection clears all the styles in the collection; or for the DeviceSpecificChoiceCollection, it clears all the choices in the collection.

Adding a field to the fields of an object list changes the data-binding behavior of the control, and requires you to bind data to the control again.

Example

The following example demonstrates how to use the Clear method to clear the DeviceSpecificChoiceCollection .

Public Sub Form_Init(sender As Object, e As EventArgs)
   
   Dim devSpecific As New DeviceSpecific()
   Dim devChoiceHtml As New DeviceSpecificChoice()
   devChoiceHtml.Filter = "isHTML32"
   devSpecific.Choices.Add(devChoiceHtml)
   devSpecific.Choices.Clear()

End Sub 

[C#]

public void Form_Init(object sender, EventArgs e)
{
   DeviceSpecific devSpecific = new DeviceSpecific();
   DeviceSpecificChoice devChoiceHtml = new DeviceSpecificChoice();
   devChoiceHtml.Filter = "isHTML32";
   devSpecific.Choices.Add(devChoiceHtml);
   devSpecific.Choices.Clear();
} 

See Also

Applies to: DeviceSpecificChoiceCollection Class | MobileListItemCollection Class | ObjectListCommandCollection Class | ObjectListFieldCollection Class | ObjectListItemCollection Class | StyleSheet Class