Hi Alex,_______________________________________________Not sure about your class but you can use codecs to create custom code to convert your objects from .Net to Python.Here is how I use it:public class DoubleArrayPythonEncoder : IPyObjectEncoder
{
public static DoubleArrayPythonEncoder Instance { get; } = new DoubleArrayPythonEncoder();
public bool CanEncode(Type type)
{
return type == typeof(double[]);
}
public PyObject TryEncode(object value)
{
if (value is double[] doublearray)
{
var pyList = new PyList();
for (int i = 0; i < doublearray.Length - 1; i++)
{
pyList.Append(new PyFloat(doublearray[i]));
}
return pyList;
}
return null;
}
public static void Register()
{
PyObjectConversions.RegisterEncoder(Instance);
}
}
In Python, just call Register() before getting object.I hope it helps!Regards,+1 (438) 926-6458
On Dec 2, 2020 at 2:37:39 PM, AlexM <alexmasis@gmail.com> wrote:_______________________________________________
PythonNet mailing list -- pythonnet@python.org
To unsubscribe send an email to pythonnet-leave@python.org
https://mail.python.org/mailman3/lists/pythonnet.python.org/
Member address: manu@upsim.tech
PythonNet mailing list -- pythonnet@python.org
To unsubscribe send an email to pythonnet-leave@python.org
https://mail.python.org/mailman3/lists/pythonnet.python.org/
Member address: alexmasis@gmail.com