FileStream::SafeFileHandle Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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:
property SafeFileHandle^ SafeFileHandle {
	[SecurityCriticalAttribute]
	[SecurityPermissionAttribute(SecurityAction::InheritanceDemand, 
		Flags = SecurityPermissionFlag::UnmanagedCode)]
	virtual SafeFileHandle^ 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: