C++ struct two dimension array into C# [duplicate]

痴心易碎 提交于 2020-01-15 03:44:29

问题


Possible Duplicate:
What does “Invalid managed/unmanaged type combination.” mean?

how we will code these structures(Written in C++) in C#

typedef struct tagBIRDMATRIX
{
short   n[3][3];    // array of matrix elements
}BIRDMATRIX;

回答1:


The size should be the number of elements in your cross product.

 struct BIRDMATRIX
 {
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
    short[,] n;
 }


来源:https://stackoverflow.com/questions/6197504/c-struct-two-dimension-array-into-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!