SectionInformation.ForceDeclaration 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
强制关联的配置节出现在配置文件中。
重载
| ForceDeclaration() | 强制关联的配置节出现在配置文件中。 | 
| ForceDeclaration(Boolean) | 强制关联的配置节出现在配置文件中,或者从配置文件中移除现有节。 | 
注解
从父文件继承配置节时,不会将其写入配置文件中。 如果希望父部分显示在子配置文件中,则必须将 设置为 ForceDeclarationtrue。 这使得配置文件从一台计算机到另一台计算机的可移植性更高。 这样,即使你无法控制父配置文件,也可以确保分区存在。
ForceDeclaration()
- Source:
- SectionInformation.cs
- Source:
- SectionInformation.cs
- Source:
- SectionInformation.cs
强制关联的配置节出现在配置文件中。
public:
 void ForceDeclaration();public void ForceDeclaration ();member this.ForceDeclaration : unit -> unitPublic Sub ForceDeclaration ()注解
方法 ForceDeclaration 强制将此 SectionInformation 声明写入配置文件。
注意
方法 ForceDeclaration 可以强制 SectionInformation 将声明写入配置文件,即使节不是必需的,因为它已在父文件中声明。 ForceDeclaration使用 方法可以使配置文件从一台计算机到另一台计算机的可移植性更高。 它使你能够确保即使你没有对父配置文件的控制,该节也存在。
适用于
ForceDeclaration(Boolean)
- Source:
- SectionInformation.cs
- Source:
- SectionInformation.cs
- Source:
- SectionInformation.cs
强制关联的配置节出现在配置文件中,或者从配置文件中移除现有节。
public:
 void ForceDeclaration(bool force);public void ForceDeclaration (bool force);member this.ForceDeclaration : bool -> unitPublic Sub ForceDeclaration (force As Boolean)参数
- force
- Boolean
如果应将关联的节写入配置文件,则为 true;否则为 false。
例外
              force 为 true,且关联的节无法导出到子配置文件,或者该节未声明。
示例
下面的示例显示如何使用 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)
注解
如果 force 为 true,则 ForceDeclaration 方法强制将此SectionInformation声明写入配置文件。 如果 force 为 false,则系统需要声明时 SectionInformation ,可能会忽略此操作。
注意
方法 ForceDeclaration 可以强制 SectionInformation 将声明写入配置文件,即使不需要此部分,因为它已在父文件中声明。 ForceDeclaration使用 方法可以使配置文件从一台计算机到另一台计算机的可移植性更高。 这样,即使你无法控制父配置文件,也可以确保分区存在。