how to instantiate System.Management.ManagementObjectSearcher

Mar 18, 2010 at 2:53 PM

I'm trying to instantiate System.Management.ManagementObjectSearcher but my code below doesn't work:

Is there something wrong with this code?

(import (rnrs)

               (ironscheme clr))

(clr-using System.Management)

(System.Management.ManagementObjectSearcher. "SELECT foo")

 

 

Coordinator
Mar 18, 2010 at 3:45 PM
larbac wrote:

I'm trying to instantiate System.Management.ManagementObjectSearcher but my code below doesn't work:

Is there something wrong with this code?

Just a little  :)

Try this:

(import 
  (rnrs) 
  (ironscheme clr))

(clr-using System.Management)

(clr-new ManagementObjectSearcher "SELECT FOO")

Mar 18, 2010 at 7:33 PM
Edited Mar 18, 2010 at 7:37 PM

I get a "type not found" error when I try to do the (clr-new ManagementObjectSearcher "SELECT FOO").

Thanks in advance.

(Edit: here is the error)

IronScheme 1.0 RC 1 ironscheme.codeplex.com © leppie 2007,2008,2009
> (import (rnrs)
. (ironscheme clr))
> (clr-using System.Management)
> (clr-new ManagementObjectSearcher "SELECT FOO")
Unhandled exception during evaluation:
&who: "ExtractTypeInfo"
&message: "type not found"
&syntax:
  form: "ManagementObjectSearcher"
  subform: #f

>

Coordinator
Mar 18, 2010 at 7:54 PM

Try adding

(clr-reference System.Management)

after the import/using clause.

Mar 18, 2010 at 9:03 PM

It's working! Thank you!