Пример #1
0
        public unsafe ObjectReference <T> As <T>(Guid iid)
        {
            ThrowIfDisposed();
            Marshal.ThrowExceptionForHR(VftblIUnknown.QueryInterface(ThisPtr, ref iid, out IntPtr thatPtr));
            if (IsAggregated)
            {
                Marshal.Release(thatPtr);
            }
            AddRefFromTrackerSource();

            var objRef = ObjectReference <T> .Attach(ref thatPtr);

            objRef.IsAggregated            = IsAggregated;
            objRef.PreventReleaseOnDispose = IsAggregated;
            objRef.ReferenceTrackerPtr     = ReferenceTrackerPtr;
            return(objRef);
        }
Пример #2
0
 public unsafe ObjectReference <T> As <T>(Guid iid)
 {
     ThrowIfDisposed();
     Marshal.ThrowExceptionForHR(VftblIUnknown.QueryInterface(ThisPtr, ref iid, out IntPtr thatPtr));
     return(ObjectReference <T> .Attach(ref thatPtr));
 }