StringExt.IsSubDirectoryOf Method
Checks if a path is a child of another path. Adapted from https://stackoverflow.com/questions/8091829/how-to-check-if-one-path-is-a-child-of-another-path
Namespace: UltimateXR.Extensions.System
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static bool IsSubDirectoryOf(
this string candidate,
string other,
bool canBeSame = true
)
Parameters
- candidate
- Type: System.String
Path candidate - other
- Type: System.String
Path to check against - canBeSame (Optional)
- Type: System.Boolean
Whether to also consider the same directory as valid
Return Value
Type: Boolean
Whether the path is child of the parent path
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).