ITCOOKBOOK.com

 Options

Current Time:
Mon Sep 06, 2010 9:26 pm
View unanswered posts

Log in

Username:
Password:
Log me on automatically each visit

Topic Information

Casting & WMI Problem

 
Post new topic   Reply to topic    ITCOOKBOOK.com Forum Index -> C#
View previous topic :: View next topic  
Author Message
alig
Fresher


Joined: 01 Dec 2006
Posts: 4

PostPosted: Fri Dec 01, 2006 9:24 pm    Post subject: Casting & WMI Problem Reply with quote

I keep getting a casting exception in the following section of the code. I can't seem to convert from the ‘object’ to ‘int’.

Is there any way of getting the first element from “queryCollection” other than having to enumerate through it?

Quote:
ManagementObjectCollection queryCollection = query.Get();
int tempint;
Object obj;
foreach(ManagementObject mo in queryCollection)
{

obj = mo.InvokeMethod("Terminate", null);
here---------->tempint = (int) obj;
return tempint;
}

_________________
~booyakasha!
bo!
ALI
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ITCOOKBOOK.com Forum Index -> C# All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Help US Help YOU

 

 

Please complete our short survey and save $17.50 on ITCOOKBOOK.COM.

 

 

Take a look at SAPTrends.com, a new blog dedicated to discussion of SAP Training trends in SAP ERP.

 

 

C# Interview Questions

 

.NET Interview Questions

 

Java Interview Questions

 

Python Interview Questions

 

ColdFusion Interview Questions

 

Linux Interview Questions

 

Linux LPIC 1 Certification Questions

 

Perl Programming Interview Questions