Share via


IsPathRooted Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

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

Syntax

'Declaration
Public Shared Function IsPathRooted ( _
    path As String _
) As Boolean
public static bool IsPathRooted(
    string path
)
public:
static bool IsPathRooted(
    String^ path
)
static member IsPathRooted : 
        path:string -> bool 
public static function IsPathRooted(
    path : String
) : boolean

Parameters

Return Value

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

Remarks

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".

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

.NET Framework Security

See Also

Reference

Path Class

System.IO Namespace