创建intPtr到矩阵

时间:2016-03-10 10:31:28

标签: c# pointers intptr

我使用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 

如何进行此转换?

0 个答案:

没有答案