[IronPython] RuntimeType from PythonType in C# code
anleewxs at gmail.com
Thu Apr 9 18:14:24 CEST 2009
I have embedded IronPython 2.01 into my C# application, and am
extremely impressed by the ease of integration and the
interoperability with the .NET types. However I am a bit stumped by
something that probably is quite simple.
1) In a python script, I import one of my application types.
2) From that script I call a function implemented in C#. I pass in
the type (not an instance of the type)
3) My C# function sees a PythonType. I would like to get the
associated RuntimeType, but can't figure out how to do so.
For example (using a system type):
from System import String
myfunction(String) # calls C# delegate defined below
// o is of type PythonType. I would like to get the associated
System.RuntimeType (in this case System.String)
I've searched the web, but most of the advice seems outdated:
PythonType.UnderlyingSystemType is internal, so I can't access it.
I'm not sure what "Ops" is. I suspect it is related to the namespace
IronPython.Runtime.Operations, but I can't find an equivalent
class/function in there (although there is quite a bit there, so I may
have missed it).
Any help would be greatly appreciated.
More information about the Ironpython-users