I have a project that uses both managed C# and an unmanaged COM object. I
would like to know the best way to transfer large chunks of data between the
two? I have a continuous stream of BYTE arrays that are on average 4k in
size that I need to move from the COM object to C# as fast and efficient as
possible. I'm thinking either an event that passes in a SafeArray or
using a socket.
Does anyone have any experience with and know what will perform best for me?
Bob
If your C# code does not run with restricted CAS permissions, you can use
the C# compiler option /unsafe, the C# keyword unsafe, and byte* types in
your C# code. Using this, you can pass a native pointer from native code to
managed code. This means that noting needs to be copied. On the C# side, you
can either use C++ like pointer arithmetics to iterate throurgh the native
arrray, or you can use the UnmanagedMemoryStream.
Marcus
>I have a project that uses both managed C# and an unmanaged COM object. I
>would like to know the best way to transfer large chunks of data between
[quoted text clipped - 7 lines]
>
> Bob