PathIsPathRooted Method (String, Boolean) |
[AlphaFS] Gets a value indicating whether the specified path string contains absolute or relative path information.
Namespace: Alphaleonis.Win32.FilesystemAssembly: AlphaFS (in AlphaFS.dll) Version: 2.0
Syntax public static bool IsPathRooted(
string path,
bool checkInvalidPathChars
)
Public Shared Function IsPathRooted (
path As String,
checkInvalidPathChars As Boolean
) As Boolean
public:
static bool IsPathRooted(
String^ path,
bool checkInvalidPathChars
)
static member IsPathRooted :
path : string *
checkInvalidPathChars : bool -> bool
Parameters
- path
- Type: SystemString
The path to test. The path cannot contain any of the characters defined in GetInvalidPathChars. - checkInvalidPathChars
- Type: SystemBoolean
will check path for invalid path characters.
Return Value
Type:
Boolean if
path contains a root; otherwise,
.
Exceptions Remarks
The IsPathRooted method returns true if the first character is a directory separator character such as
DirectorySeparatorChar, or if the path starts with a drive letter and colon (
VolumeSeparatorChar). For
example, it returns true for path strings such as "\\MyDir\\MyFile.txt", "C:\\MyDir", or "C:MyDir". It returns
for
path strings such as "MyDir".
Remarks This method does not verify that the path or file name exists.
See Also