- groups
- An array of type System.Windows.Forms.ListViewGroup that specifies the groups to add to the collection.
Use this version of the ListViewGroupCollection.AddRange(ListViewGroup[]) method to add an array of groups to the group collection. This method is useful when you create multiple System.Windows.Forms.ListViewGroup objects and want to add them to the collection with a single method call. To add individual groups to the collection, use the ListViewGroupCollection.Add(ListViewGroup) method.
This method is also useful when you want to provide multiple ways to group the items in a System.Windows.Forms.ListView control. To do this, create multiple group arrays. To change the grouping, first use the ListViewGroupCollection.Clear method to remove all the groups from the collection, then use the ListViewGroupCollection.AddRange(ListViewGroup[]) method to add a different array of groups.
Unlike the ListViewGroupCollection.Add(ListViewGroup) method, the ListViewGroupCollection.AddRange(ListViewGroup[]) method does not have a return value that can be used to determine whether a group being added is already in the collection. If you need this information, use the ListViewGroupCollection.Contains(ListViewGroup) method before using the ListViewGroupCollection.AddRange(ListViewGroup[]) method.