October 10, 2006

Dancing Machine!

Filed under: Fun Stuff! — Phillip Holmes @ 12:00 am

Aiden is 19 months now. His height and our level of love and adoration are all off the chart!
Here is a little video that I took of him on October 1st.

Aiden Holmes doing the ABCs dance!

October 9, 2006

The NameObjectCollection Class

Filed under: .NET — Phillip Holmes @ 1:33 am

I ran across this in the System.Collections.Specialized namespace and thought it was a very interesting class.

The only downside of NameValueCollection is that it will only accepts strings as types even though it is based on hashtable. The tremendous benefits to using this class are that you can have multiple values per key AND your values are not reordered.

C#:

  1. using System;
  2. using System.Collections.Specialized;
  3. using System.Text;
  4.  
  5.  
  6. static void Main() {
  7.     NameValueCollection stFoo = new NameValueCollection();
  8.     stFoo.Add("akey", "value1");
  9.     stFoo.Add("akey", "value2");
  10.     stFoo.Add("akey", "value3");
  11.     stFoo.Add("bkey", "value1");
  12.     stFoo.Add("bkey", "value2");
  13.     stFoo.Add("bkey", "value3");
  14.     string[] a_foo = stFoo.GetValues("akey");
  15.     foreach (string it in a_foo) {
  16.         Console.WriteLine(it);
  17.     }
  18.     string[] b_foo = stFoo.GetValues("bkey");
  19.     foreach (string it in b_foo) {
  20.         Console.WriteLine(it);
  21.     }
  22. }

The Holmes Blog