ProfileSection.AutomaticSaveEnabled 属性

定义

获取或设置一个值,该值确定页退出时是否自动保存对用户配置文件信息的更改。Gets or sets a value that determines whether changes to user-profile information are automatically saved on page exit.

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

属性值

Boolean

如果页退出时自动保存配置文件信息,则为 true;否则为 falsetrue if profile information is automatically saved on page exit; otherwise, false. 默认值为 trueThe default is true.

属性

示例

下面的代码示例说明如何使用 AutomaticSaveEnabled 属性。The following code example shows how to use the AutomaticSaveEnabled property. 此代码示例是为类提供的更大示例的一部分 ProfileSectionThis code example is part of a larger example provided for the ProfileSection class.


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

注解

AutomaticSaveEnabled 属性为时 false ,除非 Save ProfileCommon 在代码中调用类的方法,否则不会保存对单个配置文件的更改。When the AutomaticSaveEnabled property is false, changes to individual profiles are not saved unless the Save method of the ProfileCommon class is called in code. AutomaticSaveEnabled 属性为时 trueProfileAutoSaving 事件还允许代码重写自动保存行为。When the AutomaticSaveEnabled property is true, the ProfileAutoSaving event also allows code to override the automatic save behavior.

适用于

另请参阅