Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 2 additions & 102 deletions xml/System.Configuration/AppSettingsReader.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,57 +33,7 @@
<Interfaces />
<Docs>
<summary>Provides a method for reading values of a particular type from the configuration.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Examples
The following example creates a configuration file that contains the `<appSettings>` section, and then uses the <xref:System.Configuration.AppSettingsReader> to read the settings just generated.

```csharp
using System;
using System.Configuration;

class Program
{
static void Main(string[] args)
{
var reader = new AppSettingsReader();

var stringSetting = reader.GetValue("String setting", typeof(string));
Console.WriteLine("String setting: " + stringSetting);

var dateTimeSetting = reader.GetValue("DateTime setting", typeof(DateTime));
Console.WriteLine("DateTime setting: " + dateTimeSetting);

try
{
var missingSetting = reader.GetValue("Int setting", typeof(Int32));
}
catch (InvalidOperationException e)
{
Console.WriteLine("Missing key error: " + e.Message);
}

Console.WriteLine("Press any key to continue");
Console.ReadKey();
}
}
```

The following example demonstrates a configuration file used by the previous example.

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="String setting" value="String retrieved from App.Config"/>
<add key="Date setting" value="Thursday, December 01, 2005 12:53:56 PM"/>
</appSettings>
</configuration>
```

]]></format>
</remarks>
<remarks>To be added.</remarks>
<altmember cref="T:System.Configuration.AppSettingsSection" />
</Docs>
<Members>
Expand Down Expand Up @@ -115,57 +65,7 @@ class Program
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Configuration.AppSettingsReader" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Examples
The following example creates a configuration file that contains the `<appSettings>` section, and then uses the <xref:System.Configuration.AppSettingsReader> to read the settings just generated.

```csharp
using System;
using System.Configuration;

class Program
{
static void Main(string[] args)
{
var reader = new AppSettingsReader();

var stringSetting = reader.GetValue("String setting", typeof(string));
Console.WriteLine("String setting: " + stringSetting);

var dateTimeSetting = reader.GetValue("DateTime setting", typeof(DateTime));
Console.WriteLine("DateTime setting: " + dateTimeSetting);

try
{
var missingSetting = reader.GetValue("Int setting", typeof(Int32));
}
catch (InvalidOperationException e)
{
Console.WriteLine("Missing key error: " + e.Message);
}

Console.WriteLine("Press any key to continue");
Console.ReadKey();
}
}
```

The following example demonstrates a configuration file used by the previous example.

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="String setting" value="String retrieved from App.Config"/>
<add key="Date setting" value="Thursday, December 01, 2005 12:53:56 PM"/>
</appSettings>
</configuration>
```

]]></format>
</remarks>
<remarks>To be added.</remarks>
<altmember cref="T:System.Configuration.AppSettingsSection" />
</Docs>
</Member>
Expand Down
21 changes: 1 addition & 20 deletions xml/System.Configuration/AppSettingsSection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,7 @@
<Interfaces />
<Docs>
<summary>Provides configuration system support for the <see langword="appSettings" /> configuration section. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks
The `appSettings` configuration section provides for key/value pairs of `string` values for an application. Rather than accessing these values by using an instance of an <xref:System.Configuration.AppSettingsSection> object, you should use the <xref:System.Configuration.ConfigurationManager.AppSettings> property of the <xref:System.Configuration.ConfigurationManager> class or the <xref:System.Web.Configuration.WebConfigurationManager.AppSettings> property of the <xref:System.Web.Configuration.WebConfigurationManager> class.



## Examples
The following example shows how to use the <xref:System.Configuration.AppSettingsSection> class in a console application. It reads and writes the key/value pairs that are contained by the `appSettings` section. It also shows how to access the <xref:System.Configuration.AppSettingsSection.File> property of the <xref:System.Configuration.AppSettingsSection> class.

> [!NOTE]
> Before you compile this code, add a reference in your project to System.Configuration.dll.

:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.AppSettingsSection/CS/UsingAppSettingsSection.cs" id="Snippet21":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.AppSettingsSection/VB/AppSettingsSection.vb" id="Snippet21":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.AppSettingsSection/VB/UsingAppSettingsSection.vb" id="Snippet21":::

]]></format>
</remarks>
<remarks>To be added.</remarks>
<altmember cref="T:System.Configuration.ConfigurationManager" />
</Docs>
<Members>
Expand Down
4 changes: 2 additions & 2 deletions xml/System.Configuration/ApplicationSettingsBase.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<format type="text/markdown"><![CDATA[

## Remarks
This constructor initializes the <xref:System.Configuration.ApplicationSettingsBase.SettingsKey> property to the value of the `settingsKey` parameter. This property is useful in disambiguating different instances of the settings wrapper class in the same application domain.
This constructor initializes the <xref:System.Configuration.ApplicationSettingsBase.SettingsKey> property to the value of the `settingsKey` parameter. This property is useful in disambiguating different instances of the settings wrapper class.

For information about how reflection is used during the instantiation of a wrapper class, see the default <xref:System.Configuration.ApplicationSettingsBase.%23ctor> constructor.

Expand Down Expand Up @@ -294,7 +294,7 @@
## Remarks
The <xref:System.ComponentModel.IComponent> object specified by the `owner` parameter acts as the owner of the current instance of this applications settings class. During the initialization of the settings wrapper class derived from <xref:System.Configuration.ApplicationSettingsBase>, the owner's site is queried for a <xref:System.Configuration.ISettingsProviderService>. If one exists, it is used in preference to native settings provider for all the properties of the wrapper class, as specified by the <xref:System.Configuration.SettingsProviderAttribute>.

This constructor initializes the <xref:System.Configuration.ApplicationSettingsBase.SettingsKey> property to the value of the `settingsKey` parameter. This property is useful in disambiguating different instances of the wrapper class in the same application domain.
This constructor initializes the <xref:System.Configuration.ApplicationSettingsBase.SettingsKey> property to the value of the `settingsKey` parameter. This property is useful in disambiguating different instances of the wrapper class.

For information about how reflection is used during the instantiation of a wrapper class, see the default <xref:System.Configuration.ApplicationSettingsBase.%23ctor> constructor.

Expand Down
5 changes: 2 additions & 3 deletions xml/System.Configuration/ClientSettingsSection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@
<format type="text/markdown"><![CDATA[

## Remarks
The .NET Framework contains a single default settings provider, <xref:System.Configuration.LocalFileSettingsProvider>, which stores configuration data to the local file system in files with the extension `.config`. The contents of configuration files are structured as XML documents. User-scoped settings are persisted in a file with the name `username.config`. Within this file, data is stored as elements within a `<userSettings>` section. Each of these sections is represented by a corresponding <xref:System.Configuration.ClientSettingsSection>. Each section object is owned and administered by a configuration section handler, which is an <xref:System.Configuration.IConfigurationSectionHandler>.

The <xref:System.Configuration.ClientSettingsSection> class represents a simple extension of the <xref:System.Configuration.ConfigurationSection> class, which is used in the .NET Framework support for general configuration files.
.NET contains a single default settings provider, <xref:System.Configuration.LocalFileSettingsProvider>, which stores configuration data to the local file system in files with the extension `.config`. The contents of configuration files are structured as XML documents. User-scoped settings are persisted in a file with the name `username.config`. Within this file, data is stored as elements within a `<userSettings>` section. Each of these sections is represented by a corresponding <xref:System.Configuration.ClientSettingsSection>. Each section object is owned and administered by a configuration section handler, which is an <xref:System.Configuration.IConfigurationSectionHandler>.

For more information about application settings, see the topic [Application Settings for Windows Forms](/dotnet/desktop/winforms/advanced/application-settings-for-windows-forms).
The <xref:System.Configuration.ClientSettingsSection> class represents a simple extension of the <xref:System.Configuration.ConfigurationSection> class, which is used in the .NET support for general configuration files.

]]></format>
</remarks>
Expand Down
21 changes: 4 additions & 17 deletions xml/System.Configuration/Configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,19 @@
You can get a <xref:System.Configuration.Configuration> object by using the following classes:

- The <xref:System.Configuration.ConfigurationManager> class, if your entity is a client application.

- The <xref:System.Web.Configuration.WebConfigurationManager> class, if your entity is a Web application.

The names of the methods that return a <xref:System.Configuration.Configuration> object begin with "Open".

You can also generate a configuration file that represents the configuration settings in a <xref:System.Configuration.Configuration> object. To do this, use one of the following methods:

- Call the <xref:System.Configuration.Configuration.Save*> method to create a new configuration file.

- Call the <xref:System.Configuration.Configuration.SaveAs*> method to generate a new configuration file at another location.

The names of the methods that create configuration files begin with "Save".

> [!NOTE]
> To enable access to configuration settings on a remote computer, use the Aspnet_regiis command-line tool. For information about creating and accessing custom configuration settings other than the intrinsic sections included in the .NET Framework, refer to <xref:System.Configuration.ConfigurationSection>.


> To enable access to configuration settings on a remote computer, use the Aspnet_regiis command-line tool. For information about creating and accessing custom configuration settings other than the intrinsic sections included in .NET, see <xref:System.Configuration.ConfigurationSection>.

## Examples
The following code example demonstrates how to use the <xref:System.Configuration.Configuration> class to access configuration file elements.
Expand Down Expand Up @@ -92,7 +88,6 @@ Note: If you use a static <see langword="GetSection" /> method that takes a path
</block>
<altmember cref="T:System.Configuration.ConfigurationSection" />
<altmember cref="T:System.Configuration.ConfigurationManager" />
<related type="Article" href="/dotnet/framework/configure-apps/">Configuration Files</related>
</Docs>
<Members>
<Member MemberName="AppSettings">
Expand Down Expand Up @@ -178,7 +173,7 @@ Note: If you use a static <see langword="GetSection" /> method that takes a path
<format type="text/markdown"><![CDATA[

## Remarks
This property enables a consumer of the .NET Framework configuration system to set a function delegate that is used to transform assembly strings found in configuration files. Visual Studio 2010 uses this property when a project is targeted for an earlier version of the .NET Framework. The function makes sure that assembly strings are formatted correctly for the targeted version of the .NET Framework when configuration files are updated.
This property enables a consumer of the .NET configuration system to set a function delegate that is used to transform assembly strings found in configuration files. The function makes sure that assembly strings are formatted correctly for the targeted version of .NET when configuration files are updated.

]]></format>
</remarks>
Expand Down Expand Up @@ -466,17 +461,9 @@ Note: If you use a static <see langword="GetSection" /> method that takes a path
<format type="text/markdown"><![CDATA[

## Remarks
The <xref:System.Configuration.Configuration.HasFile> property also returns `true` when the resource represented by this <xref:System.Configuration.Configuration> object inherits settings from a Web.config file.

The <xref:System.Configuration.Configuration.HasFile> property returns `false` when this <xref:System.Configuration.Configuration> object represents a location-specific configuration.



## Examples
The following code example demonstrates how to use the <xref:System.Configuration.Configuration.HasFile> property.
The <xref:System.Configuration.Configuration.HasFile> property returns `false` when this <xref:System.Configuration.Configuration> object represents a location-specific configuration.

:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.Configuration/CS/Configuration.cs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.Configuration/VB/Configuration.vb" id="Snippet9":::

]]></format>
</remarks>
Expand Down Expand Up @@ -1138,7 +1125,7 @@ Note: If you use a static <see langword="GetSection" /> method that takes a path
<format type="text/markdown"><![CDATA[

## Remarks
This property enables a consumer of the .NET Framework configuration system to set a function delegate that is used to transform type strings found in configuration files. Visual Studio 2010 uses this property when a project is targeted for an earlier version of the .NET Framework. The function makes sure that type strings are formatted correctly for the targeted version of the .NET Framework when configuration files are updated.
This property enables a consumer of the .NET configuration system to set a function delegate that is used to transform type strings found in configuration files. The function makes sure that type strings are formatted correctly for the targeted version of the .NET when configuration files are updated.

]]></format>
</remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@
<format type="text/markdown"><![CDATA[

## Remarks
You use this constructor to tell the .NET Framework the custom type of the property collection to be created.


You use this constructor to declare the custom type of the property collection to be created.

## Examples
The following example shows how to use the <xref:System.Configuration.ConfigurationCollectionAttribute.%23ctor*>.
Expand Down
Loading
Loading