This documentation is archived and is not being maintained.

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 { get; }
/** @property */
public SafeFileHandle get_SafeFileHandle ()

public function get SafeFileHandle () : SafeFileHandle

Not applicable.

Property Value

A SafeFileHandle 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 me 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

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: