LocalFileSettingsProvider Class
Collapse the table of content
Expand the table of content

LocalFileSettingsProvider Class


Provides persistence for application settings classes.

Namespace:   System.Configuration
Assembly:  System (in System.dll)

[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public class LocalFileSettingsProvider : SettingsProvider, IApplicationSettingsProvider


Initializes a new instance of the LocalFileSettingsProvider class.


Gets or sets the name of the currently running application.(Overrides SettingsProvider.ApplicationName.)


Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).(Inherited from ProviderBase.)


Gets the friendly name used to refer to the provider during configuration.(Inherited from ProviderBase.)


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetPreviousVersion(SettingsContext, SettingsProperty)

Returns the value of the named settings property for the previous version of the same application.

System_CAPS_pubmethodGetPropertyValues(SettingsContext, SettingsPropertyCollection)

Returns the collection of setting property values for the specified application instance and settings property group.(Overrides SettingsProvider.GetPropertyValues(SettingsContext, SettingsPropertyCollection).)


Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitialize(String, NameValueCollection)

Creates a shallow copy of the current Object.(Inherited from Object.)


Resets all application settings properties associated with the specified application to their default values.

System_CAPS_pubmethodSetPropertyValues(SettingsContext, SettingsPropertyValueCollection)

Sets the values of the specified group of property settings.(Overrides SettingsProvider.SetPropertyValues(SettingsContext, SettingsPropertyValueCollection).)


Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodUpgrade(SettingsContext, SettingsPropertyCollection)

Attempts to migrate previous user-scoped settings from a previous version of the same application.

Setting providers define a mechanism for storing configuration data used in the application settings architecture. The .NET Framework contains a single default settings provider, LocalFileSettingsProvider, which stores configuration data to the local file system. An application settings property or group of properties are associated to a specific settings provider through the use of the SettingsProviderAttribute.

Typically, the client program does not explicitly access this class; rather, the application settings architecture automatically invokes the appropriate settings provider when its services are required. For example, many of the members of ApplicationSettingsBase delegate their work to the associated settings provider.

LocalFileSettingsProvider persists settings to configuration files that have the extension .config. The contents of configuration files are structured as XML documents. Depending on whether the setting is scoped at either the application-level or user-level, the configuration data is stored as elements within an <applicationSettings> or a <userSettings> section group, respectively. Each of these section groups is represented by a corresponding AppSettingsSection or ClientSettingsSection, respectively. Each section object is owned and administered by a configuration section handler, which is an object of type IConfigurationSectionHandler.

Application-scoped settings and the default user-scoped settings are stored in a file named application.exe.config, which is created in the same directory as the executable file. Application configuration settings are read-only. Specific user data is stored in a file named user.config, stored under the user's home directory. If roaming profiles are enabled, two versions of the user configuration file could exist. In such a case, the entries in the roaming version take precedence over duplicated entries in the local user configuration file.

For more information about application settings, see Application Settings for Windows Forms.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
© 2015 Microsoft