My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
5 hours ago: If you are a developer in Berlin and need to improve your English, I'm looking for groups to teach after work: http://tanguay.info/itenglish.
6 hours ago: As far as I'm concerned, the singularity is already here, every time I wake up twitter tells me something amazing was created while I slept.
6 hours ago: We're not suffering from information overload, we're suffering from faulty filtering.
7 hours ago: Classic literature for free as nicely formatted 1-page or 2-page PDF downloads: http://www.planetebook.com/free-ebooks.asp.
7 hours ago: Yes, when you pour coffee, "a lightning storm of neuronal activity occurs almost across the entire brain": http://is.gd/eWO1T @pholdings.
23 hours ago: If you put two spaces after a period or use underlining for emphasis, you were born before 1980.
24 hours ago: Word of the day: infovore, n. an animal with a voracious appetite for information.
yesterday: It's said that on average people use less than 10% of their brain, but I think on average computers use less than 1% of their CPU.
2 days ago: Saturday fun: team drawing on two computers with six-year-old in a shared google doc diagram.
2 days ago: Someday I want to produce a developer podcast called "What's that?" but for now "the developer's life" is a nice genre: http://is.gd/eTURO.
3 days ago: Here's a use-case for datapod format, recording human-readable data that later can be used as a datasource: http://is.gd/eSsLg @pholdings.
C# CODE EXAMPLE created on Sunday, March 07, 2010 permalink
How to use NameValueCollection for a collection of items with both single and multiple keys
I needed a collection type to easily lookup values with multiple, identical keys and since I was just storing strings, the non-generic NameValueCollection was exactly what I needed, here's an example of what it can do. This example assumes you know which keys are singular and multiple in your collection. Note that if you use .Get() on a multiple key, it will nicely return a comma-delimited string.
using System;
using System.Linq;
using System.Text;
using System.Collections.Specialized;

namespace TestMultipleKeyDictionary8282
{
    public class Program
    {
        static void Main(string[] args)
        {
            NameValueCollection variables = new NameValueCollection();

            variables.Add("title", "Report #3");
            variables.Add("description", "This is the description.");
            variables.Add("note", "more information is available from marketing");
            variables.Add("note", "time limit for this project is 18 hours");
            variables.Add("todo", "expand the outline");
            variables.Add("todo", "work on the introduction");
            variables.Add("todo", "lookup footnotes");

            string[] singleVariableNames = { "title", "subtitle", "description", "author", "datePublished" };
            string[] multipleVariableNames = { "note", "todo", "info" };

            foreach (var singleVariableName in singleVariableNames)
            {
                if (variables.Get(singleVariableName) != null)
                    Console.WriteLine("{0,-15} {1}", singleVariableName, variables.Get(singleVariableName));
                else
                    Console.WriteLine("{0,-15} {1}", singleVariableName, "N/A");
            }

            foreach (var multipleVariableName in multipleVariableNames)
            {
                if (variables.Get(multipleVariableName) != null)
                    variables.GetValues(multipleVariableName).ToList().ForEach(v => Console.WriteLine("{0,-15} {1}", multipleVariableName, v));
                else
                    Console.WriteLine("{0,-15} {1}", multipleVariableName, "N/A");
            }

            ShowEntries(variables);
            variables.Remove("todo");
            ShowEntries(variables);
            variables.Clear();
            ShowEntries(variables);

            Console.ReadLine();
        }

        public static void ShowEntries(NameValueCollection nvc)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < nvc.Keys.Count; i++)
            {
                sb.Append(nvc.Keys[i] + ", ");        
            }
            Console.WriteLine("There are {0} kinds of keys: {1}", nvc.Count, sb.ToString().TrimEnd(new char[] {',',' '}));
        }
    }
}
need markup?