Udostępnij za pośrednictwem


Path.IsPathRooted Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
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

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources