ProfileSection.AutomaticSaveEnabled 属性

定义

获取或设置一个值,该值确定是否在页面退出时自动保存对用户配置文件信息的更改。

public:
 property bool AutomaticSaveEnabled { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("automaticSaveEnabled", DefaultValue=true)]
public bool AutomaticSaveEnabled { get; set; }
[<System.Configuration.ConfigurationProperty("automaticSaveEnabled", DefaultValue=true)>]
member this.AutomaticSaveEnabled : bool with get, set
Public Property AutomaticSaveEnabled As Boolean

属性值

true 如果在页面退出时自动保存配置文件信息,则为否则,为 false. 默认值为 true

属性

示例

下面的代码示例演示如何使用该 AutomaticSaveEnabled 属性。 该代码示例是 ProfileSection 类中的一个较大示例的一部分。


// Get the current AutomaticSaveEnabled property value.
Console.WriteLine(
    "Current AutomaticSaveEnabled value: '{0}'", profileSection.AutomaticSaveEnabled);

// Set the AutomaticSaveEnabled property to false.
profileSection.AutomaticSaveEnabled = false;

' Get the current AutomaticSaveEnabled property value.
Console.WriteLine( _
    "Current AutomaticSaveEnabled value: '{0}'", profileSection.AutomaticSaveEnabled)

' Set the AutomaticSaveEnabled property to false.
profileSection.AutomaticSaveEnabled = false

注解

当属性是falseAutomaticSaveEnabled,除非在代码中调用类的方法,否则不会保存Save对单个配置文件的ProfileCommon更改。 AutomaticSaveEnabled属性为true属性时,该ProfileAutoSaving事件还允许代码重写自动保存行为。

适用于

另请参阅