Path.IsPathFullyQualified 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个值,指示文件路径是否完全限定。
重载
| IsPathFullyQualified(ReadOnlySpan<Char>) | 返回一个值,该值指示由指定字符范围表示的文件路径是否固定到特定驱动器或 UNC 路径。 | 
| IsPathFullyQualified(String) | 返回一个值,该值指示指定的文件路径是否固定到特定驱动器或 UNC 路径。 | 
注解
方法的 IsPathFullyQualified 重载处理同时使用 DirectorySeparatorChar 和 字符的路径 AltDirectorySeparatorChar 。 它不会对作为参数传递给它的路径执行任何验证。 因此,URI 被解释为相对路径并返回 false。
方法) 指示 IsPathFullyQualified 的完全限定路径 (与方法) 指示 IsPathRooted 的根路径 (之间存在差异。 
              完全限定的路径或绝对路径始终定义从特定驱动器或设备到目标文件或目录的确切路径,并且不依赖于当前驱动器或当前目录。 例如,在 Windows 系统上, C:/users/user1/documents/reports/2019/january/highlights.pdf 定义从 C: 驱动器的根目录到目标文件的绝对路径  ,highlights.pdf。 
              rooted 路径指定起始驱动器或根目录,但依赖于当前目录 ((如果它由指定的驱动器) 为根目录)或当前驱动器 ((如果根目录为根目录) )。 以下示例说明了完全限定路径与根路径之间的差异。
using System;
using System.IO;
class Program
{
    static void Main()
    {
        string relative1 = "C:Documents"; 
        ShowPathInfo(relative1);
        string relative2 = "/Documents";
        ShowPathInfo(relative2);
        string absolute = "C:/Documents";
        ShowPathInfo(absolute);
    }
    private static void ShowPathInfo(string path)
    {
        Console.WriteLine($"Path: {path}");
        Console.WriteLine($"   Rooted: {Path.IsPathRooted(path)}");
        Console.WriteLine($"   Fully qualified: {Path.IsPathFullyQualified(path)}");
        Console.WriteLine($"   Full path: {Path.GetFullPath(path)}");
        Console.WriteLine();
    }
}
// The example displays the following output when run on a Windows system:
//    Path: C:Documents
//        Rooted: True
//        Fully qualified: False
//        Full path: c:\Users\user1\Documents\projects\path\ispathrooted\Documents
//
//    Path: /Documents
//       Rooted: True
//       Fully qualified: False
//       Full path: c:\Documents
//
//    Path: C:/Documents
//       Rooted: True
//       Fully qualified: True
//       Full path: C:\Documents
Imports System.IO
Module Program
    Public Sub Main()
        Dim relative1 As String = "C:Documents" 
        ShowPathInfo(relative1)
        Dim relative2 As String = "C:Documents" 
        ShowPathInfo(relative2)
        Dim absolute As String = "C:/Documents"
        ShowPathInfo(absolute)
    End Sub
    Private Sub ShowPathInfo(filepath As String)
        Console.WriteLine($"Path: {filepath}")
        Console.WriteLine($"   Rooted: {Path.IsPathRooted(filepath)}")
        Console.WriteLine($"   Fully qualified: {Path.IsPathFullyQualified(filepath)}")
        Console.WriteLine($"   Full path: {Path.GetFullPath(filepath)}")
        Console.WriteLine()
    End Sub
End Module
' The example displays the following output when run on a Windows system:
'    Path: C:Documents
'        Rooted: True
'        Fully qualified: False
'        Full path: c:\Users\user1\Documents\projects\path\ispathrooted\Documents
'
'    Path: /Documents
'       Rooted: True
'       Fully qualified: False
'       Full path: c:\Documents
'
'    Path: C:/Documents
'       Rooted: True
'       Fully qualified: True
'       Full path: C:\Documents
IsPathFullyQualified(ReadOnlySpan<Char>)
- Source:
- Path.cs
- Source:
- Path.cs
- Source:
- Path.cs
返回一个值,该值指示由指定字符范围表示的文件路径是否固定到特定驱动器或 UNC 路径。
public:
 static bool IsPathFullyQualified(ReadOnlySpan<char> path);public static bool IsPathFullyQualified (ReadOnlySpan<char> path);static member IsPathFullyQualified : ReadOnlySpan<char> -> boolPublic Shared Function IsPathFullyQualified (path As ReadOnlySpan(Of Char)) As Boolean参数
- path
- ReadOnlySpan<Char>
文件路径。
返回
如果路径固定到特定驱动器或 UNC 路径,为 true;如果路径相对于当前驱动器或工作目录,则为 false。
另请参阅
适用于
IsPathFullyQualified(String)
- Source:
- Path.cs
- Source:
- Path.cs
- Source:
- Path.cs
返回一个值,该值指示指定的文件路径是否固定到特定驱动器或 UNC 路径。
public:
 static bool IsPathFullyQualified(System::String ^ path);public static bool IsPathFullyQualified (string path);static member IsPathFullyQualified : string -> boolPublic Shared Function IsPathFullyQualified (path As String) As Boolean参数
- path
- String
文件路径。
返回
如果路径固定到特定驱动器或 UNC 路径,为 true;如果路径相对于当前驱动器或工作目录,则为 false。
例外
              path 为 null。
注解
此方法处理使用备用目录分隔符的路径。 假设根路径 () IsPathRooted(String) 不是相对路径,这经常是一个错误。 例如,“C:a”是相对驱动器,也就是说,它针对当前目录解析的 C: (root,但相对) 。 “C:\a”是根目录而不是相对目录,也就是说,当前目录不用于修改路径。