Rolls, Robert [mailto:[EMAIL PROTECTED]] wrote:
> I was hoping you didn't say that! looks as though I need copy
> to another array as then assign to the object - the object is
> sent via com interop to a third party library.
Yup, in that case your only option is to put the contents into an array
which exactly matches the size of the contents. =( Here's a quick method
that should help you do it:
<codeSnippet language="C#">
private static byte[] SizeBufferExact(byte[] buffer, int
bufferContentLength)
{
// Allocate an array exactly the size of the contents
byte[] result = new byte[bufferContentLength];
// Copy the contents over
Array.Copy(buffer, 0, result, 0, bufferContentLength);
return result;
}
</codeSnippet>
HTH,
Drew
.NET MVP
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.