FileVersionInfo.IsPatched 属性

获取一个值,该值指定该文件是否已修改,且不同于相同版本号的原始发行文件。

**命名空间:**System.Diagnostics
**程序集:**System(在 system.dll 中)

语法

声明
Public ReadOnly Property IsPatched As Boolean
用法
Dim instance As FileVersionInfo
Dim value As Boolean

value = instance.IsPatched
public bool IsPatched { get; }
public:
property bool IsPatched {
    bool get ();
}
/** @property */
public boolean get_IsPatched ()
public function get IsPatched () : boolean

属性值

如果该文件修补过,值为 true;反之,值为 false

示例

下面的示例调用 GetVersionInfo 来获取“记事本”(Notepad) 的 FileVersionInfo。然后,它在文本框内显示布尔值 IsPatched 的状态。这段代码假定已经实例化 textBox1

Private Sub GetIsPatched()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print whether the file has a patch installed.
    textBox1.Text = "File has patch installed: " & myFileVersionInfo.IsPatched
End Sub 'GetIsPatched
private void GetIsPatched() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    // Print whether the file has a patch installed.
    textBox1.Text = "File has patch installed: " + myFileVersionInfo.IsPatched;
 }
    
private:
   void GetIsPatched()
   {
      // Get the file version for the notepad.
      FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo( "%systemroot%\\Notepad.exe" );
      
      // Print whether the file has a patch installed.
      textBox1->Text = String::Concat( "File has patch installed: ", myFileVersionInfo->IsPatched );
   }
private void GetIsPatched()
{
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = 
        FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");

    // Print whether the file has a patch installed.
    textBox1.set_Text("File has patch installed: " 
        + myFileVersionInfo.get_IsPatched());
} //GetIsPatched
private function GetIsPatched() {
    //Get the file version for the notepad.
    var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    //Print whether the file has a patch installed.
    textBox1.Text = "File has patch installed: " + myFileVersionInfo.IsPatched;
 }
    

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

FileVersionInfo 类
FileVersionInfo 成员
System.Diagnostics 命名空间