FileInfo.Directory Property

 

Gets an instance of the parent directory.

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

member Directory : DirectoryInfo with get

Property Value

Type: System.IO.DirectoryInfo

A DirectoryInfo object representing the parent directory of this file.

Exception Condition
DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

SecurityException

The caller does not have the required permission.

To get the parent directory as a string, use the DirectoryName property.

The following example opens or creates a file, determines its full path, and determines and displays the full contents of the directory.

No code example is currently available or this language may not be supported.

FileIOPermission

for reading files. Associated enumeration: FileIOPermissionAccess.Read

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: