ListViewGroupCollection.Contains(ListViewGroup) Method

Definition

Determines whether the specified group is located in the collection.

C#
public bool Contains(System.Windows.Forms.ListViewGroup value);

Parameters

value
ListViewGroup

The ListViewGroup to locate in the collection.

Returns

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

Remarks

You cannot add a 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 Add method will return a value of -1 in this case. The AddRange and Insert methods, however, do not have return values. When adding groups using one of these methods, use the Contains method to determine whether a particular ListViewGroup is already in the collection.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also