Język

FileVersionInfo.ToString Metoda

Definicja

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

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, , , OriginalFilenameFileVersionFileDescriptionProductNameProductVersionIsDebugIsPatchedIsPreReleaseIsPrivateBuildIsSpecialBuild

Language.

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

Przykłady

Poniższe przykładowe wywołania GetVersionInfo , aby pobrać FileVersionInfo element dla Notatnika. Następnie wywołuje ToString metodę drukowania listy informacji o wersji pliku w polu tekstowym. Ten kod zakłada, że textBox1 wystąpienie zostało utworzone.

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ż