FileStream.SafeFileHandle Property

Definition

Gets a SafeFileHandle object that represents the operating system file handle for the file that the current FileStream object encapsulates.

public:
 virtual property Microsoft::Win32::SafeHandles::SafeFileHandle ^ SafeFileHandle { Microsoft::Win32::SafeHandles::SafeFileHandle ^ get(); };
[get: System.Security.SecurityCritical]
public virtual Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { get; }
member this.SafeFileHandle : Microsoft.Win32.SafeHandles.SafeFileHandle
Public Overridable ReadOnly Property SafeFileHandle As SafeFileHandle

Property Value

An object that represents the operating system file handle for the file that the current FileStream object encapsulates.

Attributes

Remarks

The SafeFileHandle property automatically flushes the stream and sets the current stream position to 0. This allows the file to be moved or the stream position to be reset by another stream using the SafeFileHandle returned by this property.

Security

SecurityPermission
for permission to call unmanaged code. Security action: Link Demand Associated enumeration: UnmanagedCode

SecurityCriticalAttribute
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Applies to

See also