我有一个带有ulong
输出参数的接口方法。
int ReadStream(int channelID, out ulong handle, int timeout)
我想知道是否可以创建MemoryStream
并将此句柄的句柄作为out参数传递。
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;
}