Method IsDirOrSubDir
IsDirOrSubDir(string, string)
Checks if a given path is a directory or a subdirectory of another.
Declaration
public static bool IsDirOrSubDir(string candidate, string parentDir)
Parameters
Type | Name | Description |
---|---|---|
string | candidate | Potential subdirectory path. |
string | parentDir | Parent directory 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