ListBox.SelectedObjectCollection.Contains Method (Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Determines whether the specified item is located within the collection.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public bool Contains(
	object selectedObject


Type: System.Object

An object representing the item to locate in the collection.

Return Value

Type: System.Boolean

true if the specified item is located in the collection; otherwise, false.

The Contains method enables you to determine whether an item from the ListBox.ObjectCollection class is a member of the selected items stored in the ListBox.SelectedObjectCollection. You can use this to determine if a specific item in a multiple-selection ListBox is selected.

.NET Framework
Available since 1.1
Return to top