FileVersionInfo.FileName Property

 

Gets the name of the file that this instance of FileVersionInfo describes.

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

public string FileName { get; }

Property Value

Type: System.String

The name of the file described by this instance of FileVersionInfo.

The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. Then it prints the FileName in a text box. This code assumes textBox1 has been instantiated.

private void GetFileName()
{
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo =
        FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");

    // Print the file name.
    textBox1.Text = "File name: " + myFileVersionInfo.FileName;
}

FileIOPermission

to get the file name. Associated enumeration: FileIOPermissionAccess

.NET Framework
Available since 1.1
Return to top
Show: