/// <summary> /// Determines if the given object is at or under the given directory /// </summary> /// <param name="Other">Directory to check against</param> /// <returns>True if this path is under the given directory</returns> public bool IsUnderDirectory(DirectoryReference Other) { return(CanonicalName.StartsWith(Other.CanonicalName) && (CanonicalName.Length == Other.CanonicalName.Length || CanonicalName[Other.CanonicalName.Length] == Path.DirectorySeparatorChar || Other.IsRootDirectory())); }