Mono Class Library: System.Configuration.ConfigurationSettings Overview | Members

System.Configuration.ConfigurationSettings.AppSettings Property

Provides access to the <appSettings> element of the application configuration. [Edit]

[System.Obsolete("This property is obsolete. Please use System.Configuration.ConfigurationManager.AppSettings")]
public static System.Collections.Specialized.NameValueCollection AppSettings { get; }

Value

a System.Collections.Specialized.NameValueCollection containing values of the keys contained in the <appSettings> element of the config file. [Edit]

Remarks

The following example demonstrates the use of the AppSettings property.
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]);
			}
		}
	}
}
  
[Edit]

Requirements

Namespace: System.Configuration
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0