I got an Interface method with an ulong
out parameter.
int ReadStream(int channelID, out ulong handle, int timeout)
I'm wondering if it is possible to create a MemoryStream
and pass a handle to this stream as out parameter.
like this, but I don't know if it is possible and if it is, how do I get a pointer to my stream and convert it to ulong? I tried this:
public override int ReadStream(int channelID, out ulong handle, int timeout)
{
Stream localStream = new MemoryStream();
GCHandle localHandle = GCHandle.Alloc(localStream, GCHandleType.Pinned);
IntPtr pointer = localHandle.AddrOfPinnedObject();
handle = pointer;
return kSuccess;
}