/// <summary>Initializes a new instance of the <see cref="GenericSafeHandle"/> class.</summary> /// <param name="ptr">The PTR.</param> /// <param name="closeMethod">The delegate method for closing the handle.</param> /// <param name="ownsHandle">if set to <c>true</c> [owns handle].</param> /// <exception cref="System.ArgumentNullException">closeMethod</exception> public GenericSafeHandle(IntPtr ptr, HandleCloser closeMethod, bool ownsHandle = true) : base(ptr, ownsHandle) { if (closeMethod == null) { throw new ArgumentNullException(nameof(closeMethod)); } this.closeMethod = closeMethod; }
/// <summary>Initializes a new instance of the <see cref="GenericSafeHandle"/> class.</summary> /// <param name="closeMethod">The delegate method for closing the handle.</param> protected GenericSafeHandle(HandleCloser closeMethod) : this(IntPtr.Zero, closeMethod, true) { }