Array of struct as a parameter in method

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

I have a problem in adopting C++ libraries into C# application.

In C++ I have definitions like below:

typedef struct NAME_OF_STRUCTURE
{
short param1;
short param2;
unsigned short param3;
unsigned char param4;

} NAME_OF_STRUCTURE;

uint Method(NAME_OF_STRUCTURE *list);

And the execution is like that:

NAME_OF_STRUCTURE table[250];
Method((NAME_OF_STRUCTURE*) table)

I checked it and it works properly in C++ application. But now I have
to import and use it into my C# application. I converted structure
like this:
public struct NAME_OF_STRUCTURE
{
public short param1;
public short param2;
public ushort param3;
public byte param4;
}

But I don't know how to define method, especially how to convert
(NAME_OF_STRUCTURE*) table to C# and then execute the method.

Thanks for you help.
.



Relevant Pages