private Thunk AddRoot(object o, TreeView tv) { if (o != null && o2thunk.Contains(o)) { return((Thunk)o2thunk[o]); } TreeNode n = new TreeNode(); if (o == null) { n.Text = "null"; tv.Nodes.Add(n); Thunk t = new SimpleThunk(n, o, "null"); n2thunk[n] = t; return(t); } n.Text = "(" + o.GetType().Name + ") " + Identity(o); Thunk thunk = new SimpleThunk(n, o, n.Text); o2thunk[o] = thunk; n2thunk[n] = thunk; tv.Nodes.Add(n); AddMembers(o, n.Nodes); return(thunk); }
private Thunk AddKid(object o, TreeNodeCollection tnc, string name) { TreeNode n = new TreeNode(); n.Text = name + ": " + Identity(o); tnc.Add(n); Thunk thunk = new SimpleThunk(n, o, n.Text); n2thunk[n] = thunk; if (o != null) { System.Type t = o.GetType(); if (t.IsValueType && !IsLeafType(o)) { o2thunk[o] = thunk; AddMembers(o, n.Nodes); } } return thunk; }