FileVersionInfo.ToString 方法
定义
返回 FileVersionInfo 中属性及相应值的部分列表。Returns a partial list of properties in the FileVersionInfo and their values.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
返回
该类中下列属性及相应值的列表:A list of the following properties in this class and their values: FileName, InternalName, OriginalFilename, FileVersion, FileDescription, ProductName, ProductVersion, IsDebug, IsPatched, IsPreRelease, IsPrivateBuild, IsSpecialBuild,FileName, InternalName, OriginalFilename, FileVersion, FileDescription, ProductName, ProductVersion, IsDebug, IsPatched, IsPreRelease, IsPrivateBuild, IsSpecialBuild, Language.Language.
如果文件不包含版本信息,则此列表将只包含所请求文件的名称。If the file did not contain version information, this list will contain only the name of the requested file. 布尔值将为 false,其他所有项将为 null。Boolean values will be false, and all other entries will be null.
示例
下面的示例调用 GetVersionInfo 以获取 FileVersionInfo 记事本的。The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. 然后,它调用 ToString 在文本框中打印文件版本信息的列表。Then it calls ToString to print a list of the file version information in a text box. 此代码假定 textBox1 已实例化。This code assumes textBox1 has been instantiated.
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