views:

21

answers:

1

The code in question:

TreeNode categoryNode = categories.Nodes[category]; //BREAKPOINT HERE
categoryNode.Add("New Node")

My question is less about the code itself (it all makes sense to me), so much as the debugger. When at the break point I want to look at the TreeNodes in categories.Nodes, but categories.Nodes is a TreeNodeCollection and I can't find the underlying list, array, or whatever is actually used under TreeNodeCollection's hood.

How do I navigate the TreeNodeCollection so that I can find the actual list in question?

+1  A: 

Look at individual nodes in the collection with categoryNode[0], changing the index. Or drill down into the private owner property. Its children field gives you a list of all the nodes. Or if Linq is in scope, you can type

 categoryNode.OfType<TreeNode>(), results
Hans Passant
Ok! Thanks.For those who come here later:the private owner property is a property of TreeNodeCollection, so in the example above it's categoryNode.Nodes.owner.children.Both 'owner' and 'children' are private, so in the debugger are hiding in the "Private Variable" sections of their respective objects.
Cpfohl
@Cpfohl - read this: http://blog.stackoverflow.com/2010/10/vote-early-vote-often/
Hans Passant