I have a bit of code to grab some information from WMI in C#, for the monitors hooked up to a computer. The code is like this…
String queryString = "Select * from Win32_DesktopMonitor";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(queryString)
foreach (ManagementObject obj in searcher.Get())
{
...
}
How can I find out how many objects are being returned from this query, without counting during enumeration?
Very new to this, so be gentle! 🙂
I think you have to run the
Get()function in order to get the number of objects: