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

2019-07-23 14:32发布

问题:

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;
 }