SectionInformation.RestartOnExternalChanges 属性

定义

获取或设置一个值,指定对外部配置包含文件进行更改后是否需要重新启动应用程序。Gets or sets a value that specifies whether a change in an external configuration include file requires an application restart.

public:
 property bool RestartOnExternalChanges { bool get(); void set(bool value); };
public bool RestartOnExternalChanges { get; set; }
member this.RestartOnExternalChanges : bool with get, set
Public Property RestartOnExternalChanges As Boolean

属性值

如果对外部配置包含文件进行更改后需要重新启动应用程序,则为 true;否则为 falsetrue if a change in an external configuration include file requires an application restart; otherwise, false. 默认为 trueThe default is true.

例外

选定值与某个已定义的值冲突。The selected value conflicts with a value that is already defined.

示例

下面的示例演示如何获取 ConfigurationSection 对象的 RestartOnExternalChanges 属性值。The following example shows how to get the RestartOnExternalChanges property value of a ConfigurationSection object.

static public void RestartOnExternalChanges()
{
    SectionInformation sInfo =
        GetSectionInformation();

    bool restartOnChange = 
        sInfo.RestartOnExternalChanges;
    Console.WriteLine("Section type: {0}", 
        restartOnChange.ToString());
}
Public Shared Sub RestartOnExternalChanges()

    Dim sInfo As SectionInformation = _
    GetSectionInformation()

    Dim restartOnChange As Boolean = _
    sInfo.RestartOnExternalChanges
    Console.WriteLine("Section type: {0}", _
    restartOnChange.ToString())

End Sub

注解

如果为此 ConfigurationSection 对象修改了外部包含文件中的配置设置,则将 RestartOnExternalChanges 属性设置为 "false" 以防止应用程序重新启动。Set the RestartOnExternalChanges property to false to prevent an application restart when configuration settings in the external include file are modified for this ConfigurationSection object.

适用于