SectionInformation.ForceDeclaration 方法

定義

強制關聯的組態區段出現在組態檔中。

多載

ForceDeclaration()

強制關聯的組態區段出現在組態檔中。

ForceDeclaration(Boolean)

強制關聯的組態區段出現在組態檔中,或是從組態檔中移除現有的區段。

備註

從父檔案繼承組態檔時,組態區段不會寫入組態檔中。 如果您要父區段顯示在子組態檔中,您必須將 ForceDeclaration 設定為 true。 這可讓組態檔更容易從一部計算機移植到另一部計算機。 這也可讓您確定區段存在,即使您沒有父組態檔的控制權也一樣。

ForceDeclaration()

來源:
SectionInformation.cs
來源:
SectionInformation.cs
來源:
SectionInformation.cs

強制關聯的組態區段出現在組態檔中。

public:
 void ForceDeclaration();
public void ForceDeclaration ();
member this.ForceDeclaration : unit -> unit
Public Sub ForceDeclaration ()

備註

方法 ForceDeclaration 會強制將此 SectionInformation 宣告寫入組態檔。

注意

方法 ForceDeclaration 可以強制 SectionInformation 將宣告寫入組態檔,即使區段並非必要,因為它已在父檔案中宣告。 ForceDeclaration使用方法可以讓組態檔更容易從一部計算機到另一部計算機。 它可讓您確保區段存在,即使您沒有父組態檔的控制也一定會存在。

適用於

ForceDeclaration(Boolean)

來源:
SectionInformation.cs
來源:
SectionInformation.cs
來源:
SectionInformation.cs

強制關聯的組態區段出現在組態檔中,或是從組態檔中移除現有的區段。

public:
 void ForceDeclaration(bool force);
public void ForceDeclaration (bool force);
member this.ForceDeclaration : bool -> unit
Public Sub ForceDeclaration (force As Boolean)

參數

force
Boolean

如果關聯的區段應寫入組態檔中,則為 true,否則為 false

例外狀況

forcetrue,而且關聯的區段無法匯出至子組態檔,或未宣告。

範例

下列範例會示範如何使用 ForceDeclaration 方法。

// Force the section information to be written to
// the configuration file.
section.SectionInformation.ForceDeclaration(true);
' Force the section information to be written to
' the configuration file.
section.SectionInformation.ForceDeclaration(True)

備註

如果 為 ,此方法ForceDeclaration會強制將此SectionInformation宣告寫入組態檔forcetrue 如果 為 forcefalse,則系統 SectionInformation 需要宣告時,可能會忽略此動作。

注意

方法 ForceDeclaration 可以強制 SectionInformation 將宣告寫入組態檔,即使這個區段並非必要,因為它已在父檔案中宣告。 ForceDeclaration使用方法可以讓組態檔更容易從一部計算機到另一部計算機。 這也可讓您確定區段存在,即使您沒有父組態檔的控制權也一樣。

另請參閱

適用於