int GetListCount (TypeData listType, object ob) { if (listType.Type.IsArray) return ((Array)ob).Length; else return (int) listType.Type.GetProperty ("Count").GetValue(ob,null); }