[Python.NET] Getting handles to .NET objects, un-referencing modules
Joe
solarjoe at posteo.org
Fri Apr 20 07:20:19 EDT 2018
Hello,
I have a .cs file that contains
public struct SomeStruct
{
....
}
public static class SomeClass
{
....
}
So far I use it with PythonNET like
import clr
clr.AddReference('c:\\Test\Module.dll')
from Module import SomeClass, SomeStruct
SomeClass.SomeMethod(...)
My problem is now that I need to work with dlls with
identical names and no version number set, so PythonNET will
not see them as two different dlls but as the same.
Even if I import them using the full path with AddReference.
Now I would like to use them as stated here
https://stackoverflow.com/questions/31408391/python-for-net-using-same-net-assembly-in-multiple-versions
like
x = clr.AddReference('c:\\Test\Module.dll')
But how would I get the handle to SomeClass and SomeStruct ?
Another way would be to un-reference the dlls after each use, as
described here
https://stackoverflow.com/questions/1362114/how-to-unload-a-net-assembly-reference-in-ironpython
How would that syntax look like?
Kind regards,
Joe
More information about the PythonDotNet
mailing list