Method IsDirOrSubDir
IsDirOrSubDir(DirectoryInfo, DirectoryInfo)
Checks if a given path is a directory or a subdirectory of another.
Declaration
public static bool IsDirOrSubDir(this DirectoryInfo parentDir, DirectoryInfo candidatePath)
Parameters
| Type | Name | Description |
|---|---|---|
| DirectoryInfo | parentDir | Parent directory path. |
| DirectoryInfo | candidatePath | Potential subdirectory path. |
Returns
| Type | Description |
|---|---|
| bool | Boolean value indicating whether the candidate is a subdirectory of parentDir, or is the same as parentDir. |
Examples
IsDirOrSubDir("C:\\temp", "C:\\"); //Returns true