LocalFileSettingsProvider.SetPropertyValues Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the values of the specified group of property settings.
public:
override void SetPropertyValues(System::Configuration::SettingsContext ^ context, System::Configuration::SettingsPropertyValueCollection ^ values);
public override void SetPropertyValues (System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyValueCollection values);
override this.SetPropertyValues : System.Configuration.SettingsContext * System.Configuration.SettingsPropertyValueCollection -> unit
Public Overrides Sub SetPropertyValues (context As SettingsContext, values As SettingsPropertyValueCollection)
Parameters
- context
- SettingsContext
A SettingsContext describing the current application usage.
A SettingsPropertyValueCollection representing the group of property settings to set.
Exceptions
A user-scoped setting was encountered but the current configuration only supports application-scoped settings.
-or-
There was a general failure saving the settings to the configuration file.
Remarks
A settings wrapper class, derived from ApplicationSettingsBase, contains the Save method, which is called to persist the values of all of its settings properties. This method enumerates through all the settings providers associated with its settings properties, and calls the SetPropertyValues method for each SettingsProvider to perform the actual serialization operation.
SetPropertyValues individually serializes each user-scoped application settings property to its corresponding application setting in the appropriate user.config
configuration file.
By default, the SetPropertyValues method uses the following logical sequence to determine the serialization scheme, depending on type of the settings property:
If the type has an associated TypeConverter with a ConvertToString method implementation, this conversion is used.
XML serialization is used.
However, you can specify a preferred serialization mechanism by using the SettingsSerializeAsAttribute. LocalFileSettingsProvider does not support binary serialization in Visual Studio 2005.
If a user-scoped settings property is set back to its default value explicitly, then the local file settings provider will remove the entry for the associated setting from the user configuration file. The next read access for this property will simply use the default value.
Caution
LocalFileSettingsProvider does not use encryption to persist any settings. Therefore, do not store plain text passwords or other sensitive information using this provider without taking additional precautions, such as separately encrypting the information within the configuration file. For more information, see Encrypting Configuration Information Using Protected Configuration.
Applies to
See also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈