Path.IsPathRooted Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a value indicating whether the specified path string contains a root.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

Public Shared Function IsPathRooted ( _
    path As String _
) As Boolean
public static bool IsPathRooted(
    string path
)

Parameters

Return Value

Type: System..::.Boolean
true if path contains a root; otherwise, false.

Exceptions

Exception Condition
ArgumentException

path contains one or more of the invalid characters defined in GetInvalidPathChars.

Remarks

This method does not verify that the path or file name exists.

The IsPathRooted method returns true if the first character is a directory separator character such as "\", or if the path starts with a drive letter and colon (:). For example, it returns true for path strings such as "\\MyDir\\MyFile.txt", "C:\\MyDir", or "C:MyDir". It returns false for path strings such as "MyDir".

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

Path Class

System.IO Namespace

Other Resources

Data for Windows Phone 8