public static object Unmarshal(this MarshalledStream stream) { object obj; var hr = CoGetInterfaceAndReleaseStream(stream.Stream, ref IID_IUnknown, out obj); if (hr != 0) { System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hr); } return((object)obj); }
public static void RunAsMarshalled <T>(this MarshalledStream stream, Action <T> action) { if (Thread.CurrentThread.ManagedThreadId == stream.MarshalledFromThread.ManagedThreadId) { action((T)stream.MarshalledObject); } else { var obj = Unmarshal <T>(stream.Stream); action((T)obj); } }
public static T Unmarshal <T>(this MarshalledStream stream) { return(Unmarshal <T>(stream.Stream)); }