Hi all,
I keep getting a casting exception in the following section of code. I can't seem to convert from the object to int.
Also,
is there any way of getting the first element from queryCollection other than having to enmerate through it?
Thanks for yeer help,
J.
I keep getting a casting exception in the following section of code. I can't seem to convert from the object to int.
Also,
is there any way of getting the first element from queryCollection other than having to enmerate through it?
Thanks for yeer help,
J.
Code:
ManagementObjectCollection queryCollection = query.Get();
int tempint;
Object obj;
foreach(ManagementObject mo in queryCollection)
{
obj = mo.InvokeMethod("Terminate", null);
here---------->tempint = (int) obj;
return tempint;
}