How can IronPython access a public static value defined in C#?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How can IronPython access a public static value defined in C#?

Doug Blank
Consider this C# code:

public static class Graphics {
  public static Color white = new Color(255, 255, 255);
}

I can compile and import this from IronPython:

>>> import clr
>>> clr.AddReference("Graphics")
>>> import Graphics
>>> Graphics.white
<Color 255,255,255>

But I can't:

>>> import clr
>>> clr.AddReference("Graphics")
>>> from Graphics import *
>>> white
Traceback (most recent call last):
  File "/home/dblank/Calico/src/engine.py", line 159, in execute
    source.Execute(self.manager.scope)
  File "<string>", line 1, in <module>
<type 'exceptions.NameError'>: name 'white' is not defined

Is there something I can do to make white accessible with "from ... import *"?

Thanks for any pointers,

-Doug
_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Loading...