FileSystemInfo.FullName 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得目錄或檔案的完整路徑。
public:
virtual property System::String ^ FullName { System::String ^ get(); };
public virtual string FullName { get; }
member this.FullName : string
Public Overridable ReadOnly Property FullName As String
屬性值
含有完整路徑的字串。
例外狀況
完整路徑和檔案名稱都超出系統定義的長度上限。
呼叫端沒有必要的權限。
範例
下列範例示範 FullName 屬性。 此程式代碼範例是針對 類別提供的較大範例的 FileSystemInfo 一部分。
static void DisplayFileSystemInfoAttributes(FileSystemInfo^ fsi)
{
// Assume that this entry is a file.
String^ entryType = "File";
// Determine if entry is really a directory
if ((fsi->Attributes & FileAttributes::Directory) == FileAttributes::Directory)
{
entryType = "Directory";
}
// Show this entry's type, name, and creation date.
Console::WriteLine("{0} entry {1} was created on {2:D}", entryType, fsi->FullName, fsi->CreationTime);
}
static void DisplayFileSystemInfoAttributes(FileSystemInfo fsi)
{
// Assume that this entry is a file.
string entryType = "File";
// Determine if entry is really a directory
if ((fsi.Attributes & FileAttributes.Directory) == FileAttributes.Directory )
{
entryType = "Directory";
}
// Show this entry's type, name, and creation date.
Console.WriteLine("{0} entry {1} was created on {2:D}", entryType, fsi.FullName, fsi.CreationTime);
}
Sub DisplayFileSystemInfoAttributes(ByVal fsi As IO.FileSystemInfo)
' Assume that this entry is a file.
Dim entryType As String = "File"
' Determine if this entry is really a directory.
If (fsi.Attributes And FileAttributes.Directory) = FileAttributes.Directory Then
entryType = "Directory"
End If
' Show this entry's type, name, and creation date.
Console.WriteLine("{0} entry {1} was created on {2:D}", _
entryType, fsi.FullName, fsi.CreationTime)
End Sub
備註
例如,對於檔案 c:\NewFile.txt,此屬性會傳回 「c:\NewFile.txt」。。
如需一般 I/O 工作的清單,請參閱 一般 I/O 工作。