Dictionary - Config - Unterschied

11/10/2007 - 11:55 von Thomas Bauer | Report spam
Hallo,

wann nehme ich die AppConfig?
wann nehme ich Dictionary ?

Wo ist der Unterschied?
Habt Ihr ein besseres Beispiel?

Thomas





// A simple example for the DictionaryEntry structure.
using System;
using System.Collections;

class Example
{
public static void Main()
{
// Create a new hash table.
//
Hashtable openWith = new Hashtable();

// Add some elements to the hash table. There are no
// duplicate keys, but some of the values are duplicates.
openWith.Add("txt", "notepad.exe");
openWith.Add("bmp", "paint.exe");
openWith.Add("dib", "paint.exe");
openWith.Add("rtf", "wordpad.exe");

// When you use foreach to enumerate hash table elements,
// the elements are retrieved as KeyValuePair objects.
Console.WriteLine();
foreach (DictionaryEntry de in openWith)
{
Console.WriteLine("Key = {0}, Value = {1}", de.Key,
de.Value);
}
}
}

/* This code example produces output similar to the following:

Key = rtf, Value = wordpad.exe
Key = txt, Value = notepad.exe
Key = dib, Value = paint.exe
Key = bmp, Value = paint.exe
*/
 

Lesen sie die antworten

#1 robert
11/10/2007 - 12:23 | Warnen spam
Die config brauchst Du immer dann, wenn Du zur Laufzeit
Benutzervariablen àndern möchtest. Das Dictionary, will bei jeder
Änderung immer neu gebaut werden.

-robert

On 11 Okt., 11:55, Thomas Bauer wrote:
Hallo,

wann nehme ich die AppConfig?
wann nehme ich Dictionary ?

Wo ist der Unterschied?
Habt Ihr ein besseres Beispiel?

Thomas

// A simple example for the DictionaryEntry structure.
using System;
using System.Collections;

class Example
{
public static void Main()
{
// Create a new hash table.
//
Hashtable openWith = new Hashtable();

// Add some elements to the hash table. There are no
// duplicate keys, but some of the values are duplicates.
openWith.Add("txt", "notepad.exe");
openWith.Add("bmp", "paint.exe");
openWith.Add("dib", "paint.exe");
openWith.Add("rtf", "wordpad.exe");

// When you use foreach to enumerate hash table elements,
// the elements are retrieved as KeyValuePair objects.
Console.WriteLine();
foreach (DictionaryEntry de in openWith)
{
Console.WriteLine("Key = {0}, Value = {1}", de.Key,
de.Value);
}
}

}

/* This code example produces output similar to the following:

Key = rtf, Value = wordpad.exe
Key = txt, Value = notepad.exe
Key = dib, Value = paint.exe
Key = bmp, Value = paint.exe
*/

Ähnliche fragen