SafeFileHandle Constructor (IntPtr, Boolean)
Initializes a new instance of the SafeFileHandle class.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- preexistingHandle
-
Type:
System::IntPtr
An IntPtr object that represents the pre-existing handle to use.
- ownsHandle
-
Type:
System::Boolean
true to reliably release the handle during the finalization phase; false to prevent reliable release (not recommended).
The following example demonstrates how to open a file by using the SafeFileHandle class and the unmanaged CreateFile function.
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Available since 10
.NET Framework
Available since 2.0