Mono Class Library: System.Configuration.ConfigurationSettings Overview | MembersSystem.Configuration.ConfigurationSettings.AppSettings Property |
Provides access to the <appSettings> element of the application configuration. [Edit]
|
a System.Collections.Specialized.NameValueCollection containing values of the keys contained in the <appSettings> element of the config file. [Edit]
The following example demonstrates the use of the AppSettings property.[Edit]
C# Example /** * Simple demo of the dotnet Configuration management system * Building: * mcs -o ConfigurationSettingDemo.exe ConfigurationSettingDemo.cs */ using System.Configuration; using System; using System.Collections.Specialized; namespace ConfigSettingsDemos { class ConfigurationSettingDemo { public static void Main(){ // Fetch the generic settings object NameValueCollection settings=ConfigurationSettings.AppSettings; // Reference by the key name System.Console.WriteLine("The value of pi={0}",settings["pi"]); // Reference in a loop foreach(String key in settings.Keys){ System.Console.WriteLine("{0}={1}",key,settings[key]); } } } }
Namespace: System.Configuration
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0