SafeFileHandle Property
Collapse the table of content
Expand the table of content

FileStream.SafeFileHandle Property

 

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

Namespace:   System.IO
Assembly:  mscorlib (in mscorlib.dll)

public virtual SafeFileHandle SafeFileHandle {
	[SecurityCriticalAttribute]
	[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, 
		Flags = SecurityPermissionFlag.UnmanagedCode)]
	get;
}

Property Value

Type: Microsoft.Win32.SafeHandles.SafeFileHandle

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

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.

SecurityPermission

for permission to call unmanaged code.

Security action: Demand

Associated enumeration: UnmanagedCode

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.

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft