Path Path Path Path Class

定義

在含有檔案或目錄路徑資訊的 String 執行個體上執行作業。Performs operations on String instances that contain file or directory path information. 這些作業是以跨平台方式來執行的。These operations are performed in a cross-platform manner.

public ref class Path abstract sealed
[System.Runtime.InteropServices.ComVisible(true)]
public static class Path
type Path = class
Public Class Path
繼承
PathPathPathPath
屬性

範例

下列範例示範Path類別的一些主要成員。The following example demonstrates some of the main members of the Path class.

using namespace System;
using namespace System::IO;
int main()
{
   String^ path1 = "c:\\temp\\MyTest.txt";
   String^ path2 = "c:\\temp\\MyTest";
   String^ path3 = "temp";
   if ( Path::HasExtension( path1 ) )
   {
      Console::WriteLine( "{0} has an extension.", path1 );
   }

   if (  !Path::HasExtension( path2 ) )
   {
      Console::WriteLine( "{0} has no extension.", path2 );
   }

   if (  !Path::IsPathRooted( path3 ) )
   {
      Console::WriteLine( "The string {0} contains no root information.", path3 );
   }

   Console::WriteLine( "The full path of {0} is {1}.", path3, Path::GetFullPath( path3 ) );
   Console::WriteLine( "{0} is the location for temporary files.", Path::GetTempPath() );
   Console::WriteLine( "{0} is a file available for use.", Path::GetTempFileName() );
   Console::WriteLine( "\r\nThe set of invalid characters in a path is:" );
   Console::WriteLine( "(Note that the wildcard characters '*' and '?' are not invalid.):" );
   Collections::IEnumerator^ myEnum = Path::InvalidPathChars->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Char c =  *safe_cast<Char^>(myEnum->Current);
      Console::WriteLine( c );
   }
}

using System;
using System.IO;

class Test 
{
	
    public static void Main() 
    {
        string path1 = @"c:\temp\MyTest.txt";
        string path2 = @"c:\temp\MyTest";
        string path3 = @"temp";

        if (Path.HasExtension(path1)) 
        {
            Console.WriteLine("{0} has an extension.", path1);
        }

        if (!Path.HasExtension(path2)) 
        {
            Console.WriteLine("{0} has no extension.", path2);
        }

        if (!Path.IsPathRooted(path3)) 
        {
            Console.WriteLine("The string {0} contains no root information.", path3);
        }

        Console.WriteLine("The full path of {0} is {1}.", path3, Path.GetFullPath(path3));
        Console.WriteLine("{0} is the location for temporary files.", Path.GetTempPath());
        Console.WriteLine("{0} is a file available for use.", Path.GetTempFileName());

        /* This code produces output similar to the following:
         * c:\temp\MyTest.txt has an extension.
         * c:\temp\MyTest has no extension.
         * The string temp contains no root information.
         * The full path of temp is D:\Documents and Settings\cliffc\My Documents\Visual Studio 2005\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\temp.
         * D:\Documents and Settings\cliffc\Local Settings\Temp\8\ is the location for temporary files.
         * D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp3D.tmp is a file available for use.
         */
    }
}
Imports System.IO

Public Class Test

    Public Shared Sub Main()
        Dim path1 As String = "c:\temp\MyTest.txt"
        Dim path2 As String = "c:\temp\MyTest"
        Dim path3 As String = "temp"

        If Path.HasExtension(path1) Then
            Console.WriteLine("{0} has an extension.", path1)
        End If

        If Path.HasExtension(path2) = False Then
            Console.WriteLine("{0} has no extension.", path2)
        End If

        If Path.IsPathRooted(path3) = False Then
            Console.WriteLine("The string {0} contains no root information.", path3)
        End If

        Console.WriteLine("The full path of {0} is {1}.", path3, Path.GetFullPath(path3))
        Console.WriteLine("{0} is the location for temporary files.", Path.GetTempPath())
        Console.WriteLine("{0} is a file available for use.", Path.GetTempFileName())

        ' This code produces output similar to the following:
        ' c:\temp\MyTest.txt has an extension.
        ' c:\temp\MyTest has no extension.
        ' The string temp contains no root information.
        ' The full path of temp is D:\Documents and Settings\cliffc\My Documents\Visual Studio 2005\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\temp.
        ' D:\Documents and Settings\cliffc\Local Settings\Temp\8\ is the location for temporary files.
        ' D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp3D.tmp is a file available for use.

    End Sub
End Class

備註

「路徑」 (path) 是提供檔案或目錄位置的字串。A path is a string that provides the location of a file or directory. 路徑不一定指向磁片上的位置;例如, 路徑可能會對應至記憶體中或裝置上的位置。A path does not necessarily point to a location on disk; for example, a path might map to a location in memory or on a device. 路徑的確切格式取決於目前的平臺。The exact format of a path is determined by the current platform. 例如, 在某些系統上, 路徑的開頭可以是磁片磁碟機或磁片區代號, 而此元素不會出現在其他系統中。For example, on some systems, a path can start with a drive or volume letter, while this element is not present in other systems. 在某些系統上, 檔案路徑可以包含副檔名, 這表示檔案中儲存的資訊類型。On some systems, file paths can contain extensions, which indicate the type of information stored in the file. 副檔名的格式與平臺相依;例如, 某些系統會將擴充功能限制為三個字元, 其他則不會。The format of a file name extension is platform-dependent; for example, some systems limit extensions to three characters, and others do not. 目前的平臺也會決定用來分隔路徑元素的一組字元, 以及指定路徑時無法使用的字元集。The current platform also determines the set of characters used to separate the elements of a path, and the set of characters that cannot be used when specifying paths. 由於這些差異, Path類別的欄位以及Path類別的某些成員的確切行為, 與平臺相依。Because of these differences, the fields of the Path class as well as the exact behavior of some members of the Path class are platform-dependent.

路徑可以包含絕對或相對位置資訊。A path can contain absolute or relative location information. 絕對路徑會完整指定位置: 不論目前的位置為何, 都可以唯一識別檔案或目錄。Absolute paths fully specify a location: the file or directory can be uniquely identified regardless of the current location. 相對路徑指定部分位置: 尋找以相對路徑指定的檔案時, 會使用目前的位置做為起點。Relative paths specify a partial location: the current location is used as the starting point when locating a file specified with a relative path. 若要判斷目前的目錄, Directory.GetCurrentDirectory請呼叫。To determine the current directory, call Directory.GetCurrentDirectory.

.NET Core 1.1 和更新版本, 以及 .NET Framework 4.6.2 和更新版本也支援存取屬於裝置名稱的檔案系統物件, 例如 "\? \c:。".NET Core 1.1 and later versions and .NET Framework 4.6.2 and later versions also support access to file system objects that are device names, such as "\?\C:".

如需有關 Windows 上的檔案路徑格式的詳細資訊, 請參閱windows 系統上的檔案路徑格式For more information on file path formats on Windows, see File path formats on Windows systems.

Path類別的大部分成員都不會與檔案系統互動, 也不會驗證路徑字串所指定的檔案是否存在。Most members of the Path class do not interact with the file system and do not verify the existence of the file specified by a path string. Path修改路徑字串的類別成員 (例如ChangeExtension) 不會影響檔案系統中的檔案名。Path class members that modify a path string, such as ChangeExtension, have no effect on names of files in the file system. Path不過, 成員會驗證指定之路徑字串的內容, 並在字串包含路徑ArgumentException字串中不正確字元時擲回例外狀況, 如GetInvalidPathChars方法所傳回的字元中所定義。Path members do, however, validate the contents of a specified path string, and throw an ArgumentException exception if the string contains characters that are not valid in path strings, as defined in the characters returned from the GetInvalidPathChars method. 例如, 在以 Windows 為基礎的桌面平臺上, 不正確路徑字元可能包括引號 (")、<小於 ()、大於 (>)、管道|()、倒退鍵 (\b)、null (\ 0) 和 Unicode 字元16到18和20到25。For example, on Windows-based desktop platforms, invalid path characters might include quote ("), less than (<), greater than (>), pipe (|), backspace (\b), null (\0), and Unicode characters 16 through 18 and 20 through 25.

Path類別的成員可讓您快速且輕鬆地執行一般作業, 例如判斷副檔名是否為路徑的一部分, 以及將兩個字串結合成一個路徑名稱。The members of the Path class enable you to quickly and easily perform common operations such as determining whether a file name extension is part of a path, and combining two strings into one path name.

Path類別的所有成員都是靜態的, 因此可以呼叫, 而不需要有路徑的實例。All members of the Path class are static and can therefore be called without having an instance of a path.

注意

在接受路徑作為輸入字串的成員中, 該路徑必須格式正確, 否則會引發例外狀況。In members that accept a path as an input string, that path must be well-formed or an exception is raised. 例如, 如果路徑是完整的, 但以空格開頭, 則不會在類別的方法中修剪路徑。For example, if a path is fully qualified but begins with a space, the path is not trimmed in methods of the class. 因此, 路徑的格式不正確, 而且會引發例外狀況。Therefore, the path is malformed and an exception is raised. 同樣地, 路徑或路徑的組合不能完整限定兩次。Similarly, a path or a combination of paths cannot be fully qualified twice. 例如, 在大多數情況下, "c:\temp c:\windows" 也會引發例外狀況。For example, "c:\temp c:\windows" also raises an exception in most cases. 使用接受路徑字串的方法時, 請確定您的路徑格式正確。Ensure that your paths are well-formed when using methods that accept a path string.

在接受路徑的成員中, 路徑可以參考檔案或只是目錄。In members that accept a path, the path can refer to a file or just a directory. 指定的路徑也可以參考伺服器和共用名稱的相對路徑或通用命名慣例 (UNC) 路徑。The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. 例如, 以下是可接受的路徑:For example, all the following are acceptable paths:

  • 在 Visual Basic 中\ C#的\"c: \MyDir \MyFile.txt" 或 "c:\MyDir\MyFile.txt"。"c:\\MyDir\\MyFile.txt" in C#, or "c:\MyDir\MyFile.txt" in Visual Basic.

  • 在 Visual Basic 中\ C#的 "c: \MyDir" 或 "c:\MyDir"。"c:\\MyDir" in C#, or "c:\MyDir" in Visual Basic.

  • 中的\"MyDir \MySubdir C#", 或 Visual Basic 中的 "MyDir\MySubDir"。"MyDir\\MySubdir" in C#, or "MyDir\MySubDir" in Visual Basic.

  • 中\的 "\ C#\MyServer \MyShare", 或\Visual Basic 中的 "\myserver\myshare 則"。\ \"\\\\MyServer\\MyShare" in C#, or "\\MyServer\MyShare" in Visual Basic.

因為所有這些作業都是在字串上執行, 所以無法在所有案例中驗證結果是否有效。Because all these operations are performed on strings, it is impossible to verify that the results are valid in all scenarios. 例如, GetExtension方法會剖析您傳遞給它的字串, 並從該字串傳回延伸模組。For example, the GetExtension method parses a string that you pass to it and returns the extension from that string. 不過, 這並不表示具有該副檔名的檔案存在於磁片上。However, this does not mean that a file with that extension exists on the disk.

如需一般 i/o 工作的清單, 請參閱一般 i/o工作。For a list of common I/O tasks, see Common I/O Tasks.

欄位

AltDirectorySeparatorChar AltDirectorySeparatorChar AltDirectorySeparatorChar AltDirectorySeparatorChar

提供平台特定替代字元,用以在反映階層式檔案系統組織的路徑字串中來分隔目錄層級。Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.

DirectorySeparatorChar DirectorySeparatorChar DirectorySeparatorChar DirectorySeparatorChar

提供平台特定字元,用以在反映階層式檔案系統組織的路徑字串中分隔目錄層級。Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.

InvalidPathChars InvalidPathChars InvalidPathChars InvalidPathChars

提供字元的平台特定陣列,這些字元不可以在傳遞給 Path 類別成員的路徑字串引數中指定。Provides a platform-specific array of characters that cannot be specified in path string arguments passed to members of the Path class.

PathSeparator PathSeparator PathSeparator PathSeparator

平台特定分隔符號字元,用來分隔環境變數中的路徑字串。A platform-specific separator character used to separate path strings in environment variables.

VolumeSeparatorChar VolumeSeparatorChar VolumeSeparatorChar VolumeSeparatorChar

提供平台特定磁碟區分隔符號字元。Provides a platform-specific volume separator character.

方法

ChangeExtension(String, String) ChangeExtension(String, String) ChangeExtension(String, String) ChangeExtension(String, String)

變更路徑字串的副檔名。Changes the extension of a path string.

Combine(String[]) Combine(String[]) Combine(String[]) Combine(String[])

將一個字串陣列合併為單一路徑。Combines an array of strings into a path.

Combine(String, String) Combine(String, String) Combine(String, String) Combine(String, String)

將兩個字串合併為一個路徑。Combines two strings into a path.

Combine(String, String, String) Combine(String, String, String) Combine(String, String, String) Combine(String, String, String)

將三個字串合併為一個路徑。Combines three strings into a path.

Combine(String, String, String, String) Combine(String, String, String, String) Combine(String, String, String, String) Combine(String, String, String, String)

將四個字串合併為一個路徑。Combines four strings into a path.

EndsInDirectorySeparator(ReadOnlySpan<Char>) EndsInDirectorySeparator(ReadOnlySpan<Char>) EndsInDirectorySeparator(ReadOnlySpan<Char>) EndsInDirectorySeparator(ReadOnlySpan<Char>)

傳回的值指出路徑 (指定為唯讀範圍) 是否以目錄分隔符號結束。Returns a value that indicates whether the path, specified as a read-only span, ends in a directory separator.

EndsInDirectorySeparator(String) EndsInDirectorySeparator(String) EndsInDirectorySeparator(String) EndsInDirectorySeparator(String)

傳回的值指出所指定路徑是否以目錄分隔符號結束。Returns a value that indicates whether the specified path ends in a directory separator.

GetDirectoryName(ReadOnlySpan<Char>) GetDirectoryName(ReadOnlySpan<Char>) GetDirectoryName(ReadOnlySpan<Char>) GetDirectoryName(ReadOnlySpan<Char>)

傳回指定路徑字串的目錄資訊,此路徑以字元範圍表示。Returns the directory information for the specified path represented by a character span.

GetDirectoryName(String) GetDirectoryName(String) GetDirectoryName(String) GetDirectoryName(String)

傳回指定路徑字串的目錄資訊。Returns the directory information for the specified path string.

GetExtension(String) GetExtension(String) GetExtension(String) GetExtension(String)

指定路徑字串的副檔名 (包括句點 ".")。Returns the extension (including the period ".") of the specified path string.

GetExtension(ReadOnlySpan<Char>) GetExtension(ReadOnlySpan<Char>) GetExtension(ReadOnlySpan<Char>) GetExtension(ReadOnlySpan<Char>)

傳回檔案路徑的副檔名,此路徑以唯讀的字元範圍表示。Returns the extension of a file path that is represented by a read-only character span.

GetFileName(ReadOnlySpan<Char>) GetFileName(ReadOnlySpan<Char>) GetFileName(ReadOnlySpan<Char>) GetFileName(ReadOnlySpan<Char>)

傳回檔案路徑的檔案名稱和副檔名,此路徑以唯讀的字元範圍表示。Returns the file name and extension of a file path that is represented by a read-only character span.

GetFileName(String) GetFileName(String) GetFileName(String) GetFileName(String)

傳回指定路徑字串的檔案名稱和副檔名。Returns the file name and extension of the specified path string.

GetFileNameWithoutExtension(ReadOnlySpan<Char>) GetFileNameWithoutExtension(ReadOnlySpan<Char>) GetFileNameWithoutExtension(ReadOnlySpan<Char>) GetFileNameWithoutExtension(ReadOnlySpan<Char>)

傳回檔案路徑的檔案名稱和副檔名,此路徑以唯讀的字元範圍表示。Returns the file name without the extension of a file path that is represented by a read-only character span.

GetFileNameWithoutExtension(String) GetFileNameWithoutExtension(String) GetFileNameWithoutExtension(String) GetFileNameWithoutExtension(String)

傳回沒有副檔名的指定路徑字串的檔案名稱。Returns the file name of the specified path string without the extension.

GetFullPath(String) GetFullPath(String) GetFullPath(String) GetFullPath(String)

傳回指定路徑字串的絕對路徑。Returns the absolute path for the specified path string.

GetFullPath(String, String) GetFullPath(String, String) GetFullPath(String, String) GetFullPath(String, String)

從完整的基底路徑和相對路徑傳回絕對路徑。Returns an absolute path from a fully qualified base path and a relative path.

GetInvalidFileNameChars() GetInvalidFileNameChars() GetInvalidFileNameChars() GetInvalidFileNameChars()

取得陣列,該陣列包含檔案名稱中不允許的字元。Gets an array containing the characters that are not allowed in file names.

GetInvalidPathChars() GetInvalidPathChars() GetInvalidPathChars() GetInvalidPathChars()

取得陣列,該陣列包含路徑名稱中不允許的字元。Gets an array containing the characters that are not allowed in path names.

GetPathRoot(ReadOnlySpan<Char>) GetPathRoot(ReadOnlySpan<Char>) GetPathRoot(ReadOnlySpan<Char>) GetPathRoot(ReadOnlySpan<Char>)

從所指定字元範圍中包含的路徑取得根目錄資訊。Gets the root directory information from the path contained in the specified character span.

GetPathRoot(String) GetPathRoot(String) GetPathRoot(String) GetPathRoot(String)

取得指定路徑的根目錄資訊。Gets the root directory information of the specified path.

GetRandomFileName() GetRandomFileName() GetRandomFileName() GetRandomFileName()

傳回隨機資料夾名稱或檔案名稱。Returns a random folder name or file name.

GetRelativePath(String, String) GetRelativePath(String, String) GetRelativePath(String, String) GetRelativePath(String, String)

傳回某個路徑到另一個路徑的相對路徑。Returns a relative path from one path to another.

GetTempFileName() GetTempFileName() GetTempFileName() GetTempFileName()

在磁碟上建立具名之零位元組的唯一暫存檔案,然後傳回該檔案的完整路徑。Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.

GetTempPath() GetTempPath() GetTempPath() GetTempPath()

傳回目前使用者的暫存資料夾路徑。Returns the path of the current user's temporary folder.

HasExtension(ReadOnlySpan<Char>) HasExtension(ReadOnlySpan<Char>) HasExtension(ReadOnlySpan<Char>) HasExtension(ReadOnlySpan<Char>)

判斷指定字元範圍所表示的路徑是否包含副檔名。Determines whether the path represented by the specified character span includes a file name extension.

HasExtension(String) HasExtension(String) HasExtension(String) HasExtension(String)

判斷路徑是否包括副檔名。Determines whether a path includes a file name extension.

IsPathFullyQualified(ReadOnlySpan<Char>) IsPathFullyQualified(ReadOnlySpan<Char>) IsPathFullyQualified(ReadOnlySpan<Char>) IsPathFullyQualified(ReadOnlySpan<Char>)

傳回值,指出指定字元範圍所表示的檔案路徑是否固定在特定的磁碟機或 UNC 路徑。Returns a value that indicates whether the file path represented by the specified character span is fixed to a specific drive or UNC path.

IsPathFullyQualified(String) IsPathFullyQualified(String) IsPathFullyQualified(String) IsPathFullyQualified(String)

傳回值,指出指定的檔案路徑是否固定在特定磁碟機或 UNC 路徑。Returns a value that indicates whether the specified file path is fixed to a specific drive or UNC path.

IsPathRooted(ReadOnlySpan<Char>) IsPathRooted(ReadOnlySpan<Char>) IsPathRooted(ReadOnlySpan<Char>) IsPathRooted(ReadOnlySpan<Char>)

傳回值,指出所指定字元範圍所表示的檔案路徑是否包含根目錄。Returns a value that indicates whether the specified character span that represents a file path contains a root.

IsPathRooted(String) IsPathRooted(String) IsPathRooted(String) IsPathRooted(String)

傳回值,指出指定的路徑字串是否包含根目錄。Returns a value indicating whether the specified path string contains a root.

Join(String, String, String, String) Join(String, String, String, String) Join(String, String, String, String) Join(String, String, String, String)

將四個路徑串連成單一路徑。Concatenates four paths into a single path.

Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>)

將四個路徑元件串連成單一路徑。Concatenates four path components into a single path.

Join(String, String, String) Join(String, String, String) Join(String, String, String) Join(String, String, String)

將三個路徑串連成單一路徑。Concatenates three paths into a single path.

Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

將兩個路徑元件串連成單一路徑。Concatenates two path components into a single path.

Join(String, String) Join(String, String) Join(String, String) Join(String, String)

將兩個路徑串連成單一路徑。Concatenates two paths into a single path.

Join(String[]) Join(String[]) Join(String[]) Join(String[])

將路徑陣列串連成單一路徑。Concatenates an array of paths into a single path.

Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>) Join(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>)

將三個路徑元件串連成單一路徑。Concatenates three path components into a single path.

TrimEndingDirectorySeparator(ReadOnlySpan<Char>) TrimEndingDirectorySeparator(ReadOnlySpan<Char>) TrimEndingDirectorySeparator(ReadOnlySpan<Char>) TrimEndingDirectorySeparator(ReadOnlySpan<Char>)

修剪指定路徑根以外的一個尾端目錄分隔符號。Trims one trailing directory separator beyond the root of the specified path.

TrimEndingDirectorySeparator(String) TrimEndingDirectorySeparator(String) TrimEndingDirectorySeparator(String) TrimEndingDirectorySeparator(String)

修剪指定路徑根以外的一個尾端目錄分隔符號。Trims one trailing directory separator beyond the root of the specified path.

TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32) TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32) TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32) TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32)

嘗試將兩個路徑元件串連成單一預先配置的字元範圍,然後傳回值,指出作業是否成功。Attempts to concatenate two path components to a single preallocated character span, and returns a value that indicates whether the operation succeeded.

TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32) TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32) TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32) TryJoin(ReadOnlySpan<Char>, ReadOnlySpan<Char>, Span<Char>, Int32)

嘗試將兩個路徑元件串連成單一預先配置的字元範圍,然後傳回值,指出作業是否成功。Attempts to concatenate two path components to a single preallocated character span, and returns a value that indicates whether the operation succeeded.

適用於

另請參閱