Closed
Description
In order to do reflection, you need to acquire the Type instance for imported class.
In C#, this is done by
Type t = typeof(MyClass)
In IronPython, this is done by
t = clr.GetClrType(MyClass)
Python.net seems to be missing this functionality.
I currently have this horrible hack, and I'm unsure how far it will work:
def get_clr_type(typ):
""" simulate typeof(T) or GetClrType from IronPython.
Horrible hack, redo
"""
name = typ.__module__ + "." + typ.__name__
return Type.GetType(name)
For reference, code using this resides in: https://github.com/vivainio/pynetext/blob/master/pynetext.py
Metadata
Metadata
Assignees
Labels
No labels