C# “编组”;uint8“t”;零内容

C# “编组”;uint8“t”;零内容,c#,C#,我从编组uint8\t获得数组中的内容0。我找不到错误 C++: C#: 输出: dd.tst[0]=0 ... dd.tst[63]=0这解决了我的问题 第二种方法是使用“out”关键字。因此,当您使用它时,它将自动返回非托管内存中的值 如何声明connect函数?你不需要告诉封送员你的数组有多长吗?@Flydog57是的,我用Info\t dd=new MainForm.Info\t告诉数组的多长时间(true)@Pavel Anikhouski C++连接函数只返回iFooTyStuttU

我从编组uint8\t获得数组中的内容0。我找不到错误

C++:

C#:

输出:

dd.tst[0]=0 ... dd.tst[63]=0这解决了我的问题

第二种方法是使用“out”关键字。因此,当您使用它时,它将自动返回非托管内存中的值


如何声明
connect
函数?你不需要告诉封送员你的数组有多长吗?@Flydog57是的,我用Info\t dd=new MainForm.Info\t告诉数组的多长时间(true)@Pavel Anikhouski C++连接函数只返回iFooTyStuttUs[Case> [MalSalas(unMaundType,ByValSalm,siZeConnST=64)] < /COD>。封送拆收器看不到您在ctor上实例化了数组。
typedef struct {

    uint8_t tst[64];

} Info_t;
public struct Info_t
        {


            public byte[] tst;


            public Info_t(bool initializeByteArrays)
            {

                tst=new byte[64];

            }
        }
[DllImport(@"D.dll",  EntryPoint = "connect", ExactSpelling = false)]
public static extern ushort connect(Info_t test);


Info_t dd = new MainForm.Info_t(true);
ushort res = connect(dd);