System.Windows.Forms.ListViewGroupCollection.Contains Method

Determines whether the specified group is located in the collection.

Syntax

public bool Contains (ListViewGroup value)

Parameters

value
The System.Windows.Forms.ListViewGroup to locate in the collection.

Returns

true if the group is in the collection; otherwise, false.

Remarks

You cannot add a System.Windows.Forms.ListViewGroup to the collection more than once. However, attempting to add another copy will not throw an exception. Instead, the addition will simply fail. The ListViewGroupCollection.Add(ListViewGroup) method will return a value of –1 in this case. The ListViewGroupCollection.AddRange(ListViewGroup[]) and ListViewGroupCollection.Insert(int, ListViewGroup) methods, however, do not have return values. When adding groups using one of these methods, use the ListViewGroupCollection.Contains(ListViewGroup) method to determine whether a particular System.Windows.Forms.ListViewGroup is already in the collection.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0