public int Compare( object x, object y ) { DictionaryEntry a = (DictionaryEntry)x; DictionaryEntry b = (DictionaryEntry)y; ArrayList aList = (ArrayList)a.Value; ArrayList bList = (ArrayList)b.Value; return bList.Count - aList.Count; } }