Solved

Get Return Type of WMI Class Method

Posted on 2007-11-16
4
403 Views
Last Modified: 2013-12-17
I've looked all over MSDN and google and can't seem to find anything that really tells me how.  I'm trying to generate some code for WMI and retrieve some methods to put in some classes I'm building.  I can pull all the information about the methods except the return type of the method itself.  Can anyone shed some light on how to do this?

Here is the code I'm using.  Like I said, it allows me access to anything I need about the method except the return type of the method itself as far as I can tell.
MethodDataCollection methods = processClass.Methods;
 
            // display the method names
            //Console.WriteLine("Method Name: ");
            foreach (MethodData method in methods)
            {
                ClassMethod.QualifiersDescription = method.Qualifiers["Description"].Value.ToString();
 
                if (method.InParameters != null && (method.InParameters.Properties != null && method.InParameters.Properties.Count > 0))
                {
                    foreach (PropertyData i in method.InParameters.Properties)
                    {
                        ClassMethod.InParameters.Add(i.Name, i.Value, i.Type);
                    }
                }
 
                if (method.OutParameters != null && (method.OutParameters.Properties != null && method.OutParameters.Properties.Count > 0))
                {
                    foreach (PropertyData o in method.OutParameters.Properties)
                    {
                        ClassMethod.OutParameters.Add(o.Name, o.Value, o.Type);
                    }
                }
 
                if (method.Qualifiers != null && (method.Qualifiers != null && method.Qualifiers.Count > 0))
                {
                    foreach (QualifierData q in method.Qualifiers)
                    {
                        ClassMethod.Qualifiers.Add(q.Name, q.Value, q.IsAmended, q.PropagatesToInstance, q.PropagatesToSubclass, q.IsOverridable);
                    }
                }
                
                MethodList.Add(ClassMethod);
            }

Open in new window

0
Comment
Question by:Phreak3eb
  • 2
4 Comments
 

Expert Comment

by:gopherr
ID: 20301408
0
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 20301515
Perhaps I'm confused... but the return type of every WMI method is UInt32
0
 

Author Comment

by:Phreak3eb
ID: 20301670
Is that documented somewhere graye?  Or am I just being an idiot (which the case could very well be) :)....?
0
 
LVL 41

Expert Comment

by:graye
ID: 20302952
I'm not sure I've seen it anywhere in print, but it certainly seems to be the case.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 57
c# - Best approach for objects in functions 3 24
how to remove duplicate code from my project 5 30
Input parameteres to DragOver 2 19
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question