Exemple #1
0
        public ClosableSafeHandle MakeUnclosable()
        {
            ClosableSafeHandle bk = rent;

            rent = null;
            return(bk);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new CloseSafeHandle.
        /// </summary>
        /// <param name="preexistingHandle">An IntPtr object that represents the pre-existing handle to use.</param>
        /// <param name="ownsHandle"><c>true</c> to reliably release the handle during the finalization phase; <c>false</c> to prevent reliable release.</param>
        public MyUnclosableSafeHandle(IntPtr preexistingHandle, bool ownsHandle)
            : base(new IntPtr(-1), ownsHandle)
        {
            this.rent = new ClosableSafeHandle(preexistingHandle, ownsHandle);

            SetHandle(preexistingHandle);
        }