Updated: A Better Dictionary Initializer

Alex Henderson tactfully commented on my last post that he had already been there, done that, and got the tee shirt.  Based on his work, a refactored Hash.Init would go like this:

public static IDictionary Init(params Func<object, object>[] funcs)
{
  IDictionary values = new Hashtable(funcs.Length, StringComparer.OrdinalIgnoreCase);

  foreach (Func<object, object> func in funcs)
  {
    string key = func.Method.GetParameters()[0].Name;
    object value = func(null);
    values.Add(key, value);
  }

  return values;
}

That'll teach me for thinking I'm being innovative :)

«December»
SunMonTueWedThuFriSat
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345