ListView listView1 = new ListView(); listView1.Clear();
foreach (ListViewItem item in listView1.Items) { listView1.Items.Remove(item); }This code loops through all the items in a ListView control called listView1 and removes them one at a time using the Remove method. This achieves the same result as using the Clear method. The Clear method is part of the System.Windows.Forms package library, which is included in the .NET Framework. This package provides a set of classes for building Windows Forms applications, including controls like ListView that can be used to display and manipulate data in a graphical user interface.