DirectoryInfo.Parent Property

 

Gets the parent directory of a specified subdirectory.

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

member Parent : DirectoryInfo with get

Property Value

Type: System.IO.DirectoryInfo

The parent directory, or null if the path is null or if the file path denotes a root (such as "\", "C:", or * "\\server\share").

Exception Condition
SecurityException

The caller does not have the required permission.

For a list of common I/O tasks, see Common I-O Tasks.

The following example demonstrates referring to the parent directory of a specified directory.

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

FileIOPermission

for reading from files and directories and for access to the path. Associated enumerations: System.Security.Permissions.FileIOPermissionAccess, System.Security.Permissions.FileIOPermissionAccess

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: