arrays

X

xontrn

Hello,

I am building a .net control in C++/CLI, and it will be hosted by a C#
form. The form will load some data from file and pass it to the
control (an array of bytes):

byte[] data = new byte[length];

.... // load the data from file

mMyControl.Load(data, length); // pass data into the control

My question is, what would the declaration of Load look like?

Is it just

void Load(array<byte>^ data, int length); ??

Or do I need to use System::Array or something?
 
B

Ben Voigt [C++ MVP]

Hello,

I am building a .net control in C++/CLI, and it will be hosted by a C#
form. The form will load some data from file and pass it to the
control (an array of bytes):

byte[] data = new byte[length];

... // load the data from file

mMyControl.Load(data, length); // pass data into the control

My question is, what would the declaration of Load look like?

Is it just

void Load(array<byte>^ data, int length); ??

cli::array<System::Byte>^ is correct for the first parameter

I doubt you want to pass the array and length though, either you want the
whole array and the length is passed implicitly, or else a subset in which
case you need array, starting offset, and count.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top