FileVersionInfo.ToString Metoda

Definicja

Zwraca częściową listę właściwości w obiekcie FileVersionInfo i ich wartości.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Zwraca

Lista następujących właściwości w tej klasie i ich wartości:

FileName, InternalName, OriginalFilename, FileVersion, FileDescription, ProductName, ProductVersion, IsDebug, IsPatched, IsPreRelease, IsPrivateBuild, IsSpecialBuild,

Language.

Jeśli plik nie zawiera informacji o wersji, ta lista będzie zawierać tylko nazwę żądanego pliku. Wartości logiczne będą mieć falsewartość , a wszystkie inne wpisy będą mieć nullwartość .

Przykłady

Poniższe przykładowe wywołania GetVersionInfo w celu pobrania FileVersionInfo elementu dla Notatnika. Następnie wywołuje ToString metodę drukowania listy informacji o wersji pliku w polu tekstowym. W tym kodzie przyjęto założenie textBox1 , że zostało utworzone wystąpienie.

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

        // Print all the version information.
        textBox1->Text = myFileVersionInfo->ToString();
    }
private void GetFileVersion2()
{
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo =
        FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");

    // Print all the version information.
    textBox1.Text = myFileVersionInfo.ToString();
}
Private Sub GetFileVersion2()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe")
    
    ' Print all the version information.
    textBox1.Text = myFileVersionInfo.ToString()
End Sub

Dotyczy

Zobacz też