SectionInformation.ForceDeclaration SectionInformation.ForceDeclaration SectionInformation.ForceDeclaration SectionInformation.ForceDeclaration Method

Definition

Forces the associated configuration section to appear in the configuration file.

Overloads

ForceDeclaration() ForceDeclaration() ForceDeclaration() ForceDeclaration()

Forces the associated configuration section to appear in the configuration file.

ForceDeclaration(Boolean) ForceDeclaration(Boolean) ForceDeclaration(Boolean) ForceDeclaration(Boolean)

Forces the associated configuration section to appear in the configuration file, or removes an existing section from the configuration file.

Remarks

A configuration section is not written in a configuration file when it is inherited from a parent file. If you want the parent section to show in the child configuration file, you must set the ForceDeclaration to true. This makes a configuration file more portable from one computer to another. This also lets you make sure that the section exists even if you do not have control over parent configuration files.

ForceDeclaration() ForceDeclaration() ForceDeclaration() ForceDeclaration()

Forces the associated configuration section to appear in the configuration file.

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

Remarks

The ForceDeclaration method forces this SectionInformation declaration to be written to the configuration file.

Note

The ForceDeclaration method can force a SectionInformation declaration to be written to a configuration file, even if the section is not required because it is already declared in a parent file. Using the ForceDeclaration method can make a configuration file more portable from one computer to another. It enables you to make sure that the section exists even when you do not have control over parent configuration files.

ForceDeclaration(Boolean) ForceDeclaration(Boolean) ForceDeclaration(Boolean) ForceDeclaration(Boolean)

Forces the associated configuration section to appear in the configuration file, or removes an existing section from the configuration file.

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

Parameters

force
Boolean Boolean Boolean Boolean

true if the associated section should be written in the configuration file; otherwise, false.

Exceptions

force is true and the associated section cannot be exported to the child configuration file, or it is undeclared.

Examples

The following example shows how to use the ForceDeclaration method.

// 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)

Remarks

The ForceDeclaration method forces this SectionInformation declaration to be written to the configuration file if force is true. If force is false, this action might be ignored if the SectionInformation declaration is required by the system.

Note

The ForceDeclaration method can force a SectionInformation declaration to be written to a configuration file, even if this section is not required because it is already declared in a parent file. Using the ForceDeclaration method can make a configuration file more portable from one computer to another. This also lets you make sure that the section exists even if you do not have control over parent configuration files.

See also

Applies to