T
TDH
Hi,
I need to do a raw copy of a byte array to an Int16 array.
For e.g., I have an byte array which has length 100, and I
need to copy this to an Int16 array that has length 50. So
2 elements in the byte array gets copied to 1 element in
the Int16 array.
In VB6, this was easily done using CopyMemory. I need
something in .NET that works as fast as CopyMemory. I
can't loop thru each element in the array because the
array could have thousands of elements and looping would
be too slow.
In VB.Net, the CopyMemory function no longer works
correctly. I can call the function, but it does not
actually perform the copy. I think there are some
marshaling calls that would eventually make it work, but
I'd prefer to find a native .NET solution.
I have looked at the members of the Array class, but they
only allow copying item-to-item. They don't allow raw copy
so that 2 elements of the byte array would go into 1
element of the Int16 array.
Does anybody know how to do this kind of raw copying from
one array to another?
Thanks.
TDH
I need to do a raw copy of a byte array to an Int16 array.
For e.g., I have an byte array which has length 100, and I
need to copy this to an Int16 array that has length 50. So
2 elements in the byte array gets copied to 1 element in
the Int16 array.
In VB6, this was easily done using CopyMemory. I need
something in .NET that works as fast as CopyMemory. I
can't loop thru each element in the array because the
array could have thousands of elements and looping would
be too slow.
In VB.Net, the CopyMemory function no longer works
correctly. I can call the function, but it does not
actually perform the copy. I think there are some
marshaling calls that would eventually make it work, but
I'd prefer to find a native .NET solution.
I have looked at the members of the Array class, but they
only allow copying item-to-item. They don't allow raw copy
so that 2 elements of the byte array would go into 1
element of the Int16 array.
Does anybody know how to do this kind of raw copying from
one array to another?
Thanks.
TDH