Click here to Skip to main content
15,896,402 members
Articles / Programming Languages / XML

Custom AppSettings

Rate me:
Please Sign up or sign in to vote.
4.12/5 (7 votes)
29 Nov 2005CPOL5 min read 84.8K   1.9K   21  
Another article on AppSettings.
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;

namespace CApp
{
	/// <summary>
	/// Simple code to show what has been parsed from the App config
	/// </summary>
	class Class1
	{
		/// <summary>
		/// Punto de entrada principal de la aplicaci�n.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			try
			{
				ArrayList nvc;
				int i=0, j=0;;
				nvc = (ArrayList)ConfigurationSettings.GetConfig("appSettings");
				//nvc = (ArrayList)ConfigurationSettings.GetConfig("AppConfig");
				foreach(Hashtable hashT in nvc)
				{
					Console.WriteLine("Config Section_" + i);
					i++;
					foreach(string key in hashT.Keys)
					{
						Console.WriteLine("\t" + key + ":");
						foreach(ArrayList arr1 in ((ArrayList)hashT[key]))
						{
							Console.WriteLine("\t\t" + key + "_" + j +":");
							j++;
							foreach(DictionaryEntry dicentry in arr1)
							{						
								Console.WriteLine("\t\t\tKey: " + dicentry.Key + " @ Value: " + dicentry.Value);
							}
						}
						j=0;
					}
				}
				Console.ReadLine();
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.Message);
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
Althought i'm a Electronic Engineering, my stong side is IT.

I've developped code in different languages:
Assembly, C, Java, HTML, Javascript, Perl/CGI, VB6, and C#, in which i've been working latetly.

I'm also keen on Security and Cryptography topics, as well as on Multimedia Technologies.

Comments and Discussions