Share via


Clear Method (Collection Object)

Deletes all elements of a Visual Basic Collection object.

Public Sub Clear()

Remarks

The Clear method empties the collection and resets its Count property to 0.

Example

Dim customers As New Microsoft.VisualBasic.Collection()
' Insert code that adds customers to collection.
customers.Clear()

Requirements

Namespace: Microsoft.VisualBasic

Module: Collection

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Reference

Collection Object (Visual Basic)

Item Property (Collection Object)

Count Property (Collection Object)

Contains Method (Collection Object)

Add Method (Collection Object)

Remove Method (Collection Object)