FileSystemInfo.FullName プロパティ

定義

ディレクトリまたはファイルの絶対パスを取得します。

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 タスク を参照してください。

適用対象

こちらもご覧ください