Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I just started using pythonnet with C# and I am having trouble passing multi-dimensional arrays back and forth between python and C#. I can receive the arrays in C# but I can not convert the PyObject received to a C# object. Can someone point me to some documentation or example code to help me figure this issue out? To be a little more specific, on the python side I am creating and working with 2, 3 and 4 dimensional matrices that I would like to pass to C#. I can pass the data but I am unable to convert these matrices into C# objects. These matrices are float and integer matrices. Thank you.

You must be logged in to vote

Replies: 1 comment · 1 reply

Comment options

If the memory is contiguous, you can use myPyObject.GetBuffer in C# and copy the memory into a .NET object.

You must be logged in to vote
1 reply
@RoboEyes
Comment options

Thank you for your response, that worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.