Method IsSubDir
IsSubDir(DirectoryInfo, DirectoryInfo)
Determines if a given path is a subdirectory of another path.
Declaration
public static bool IsSubDir(this DirectoryInfo parentDir, DirectoryInfo candidatePath)
Parameters
Type | Name | Description |
---|---|---|
DirectoryInfo | parentDir | The parent directory path. |
DirectoryInfo | candidatePath | The path to test for subdirectory status. |
Returns
Type | Description |
---|---|
bool | A boolean representing whether the path is a subdirectory of the parent directory. |
Examples
IsSubDir("C:\\Program Files\\Common Files", "C:\\Program Files"); //Returns true