我使用struct来从C dll返回值,我的结构在C#中:
[StructLayout(LayoutKind.Sequential)]
public struct board
{
public IntPtr boardMatrix; //representacion matricial del tablero
public int size; //tamaño del tablero
public int id;
}
我需要为非托管内存指定int[,] matrix
定义此分配:
int[,] myMatrix;
board boardExample = new board();
boardExample.boardMatrix = myMatrix // intPtr <= [,]int
如何进行此转换?