In C#, I have a ListView control and want to obtain a count of items currently in the control's item collection, but the code below produces the error:
'System.Windows.Forms.ListView.ListViewItemCollection' does not contain a definition for 'Count' and no extension method 'Count' accepting a first argument of type 'System.Windows.Forms.ListView.ListViewItemCollection' could be found (are you missing a using directive or an assembly reference?)
ListView.ListViewItemCollection lvitems = lvDropSummary.Items;
int iLVItemsCount = lvitems.Count();
I haven't seen specific code examples anywhere getting the count of all items in a listview, but according to the documentation (and intellisense), the property exists:
using System.Linqin your using statement /header section