Installer.Commit(IDictionary) 方法

定義

當在衍生類別中被覆寫時,完成安裝異動。

public:
 virtual void Commit(System::Collections::IDictionary ^ savedState);
public virtual void Commit (System.Collections.IDictionary savedState);
abstract member Commit : System.Collections.IDictionary -> unit
override this.Commit : System.Collections.IDictionary -> unit
Public Overridable Sub Commit (savedState As IDictionary)

參數

savedState
IDictionary

IDictionary,包含集合中的所有安裝程式都執行之後的電腦狀態。

例外狀況

savedState 參數為 null

-或-

IDictionary 的儲存狀態可能已經損毀。

在安裝的 Commit(IDictionary) 階段時發生例外狀況。 這個例外狀況會被忽略,安裝會繼續進行。 不過,安裝完成之後,應用程式可能無法正常運作。

範例

下列範例示範 Commit 類別的 Installer 方法。 類別衍生自 Installer 基類,並 Commit 覆寫 方法。

// Override the 'Commit' method of the Installer class.
virtual void Commit( IDictionary^ mySavedState ) override
{
   Installer::Commit( mySavedState );
   Console::WriteLine( "The Commit method of 'MyInstallerSample' "
      "has been called" );
}
// Override the 'Commit' method of the Installer class.
public override void Commit( IDictionary mySavedState )
{
   base.Commit( mySavedState );
   Console.WriteLine( "The Commit method of 'MyInstallerSample'"
                     + "has been called" );
}
' Override the 'Commit' method of the Installer class.
Public Overrides Sub Commit(mySavedState As IDictionary)
   MyBase.Commit(mySavedState)
   Console.WriteLine("The Commit method of 'MyInstallerSample'" + _
                                                "has been called")
End Sub

給繼承者的注意事項

如果您在衍生類別中覆寫 Commit(IDictionary) 方法,請務必先在衍生方法中呼叫基類的 Commit(IDictionary) 方法。 Commit(IDictionary)只有在這個實例InstallerCollection中每個安裝程式的方法成功時,Install(IDictionary)才會呼叫 方法。 方法 Commit(IDictionary) 會儲存執行正確卸載所需的資訊,並呼叫 Commit(IDictionary) 集合中每個安裝程式的方法。

適用於

另請參閱