Getting a object property inside another object property -- pleassehelp!!

A

almurph

Hi,


I have an object of type Tree. These objects contains properties. 1
of the properties is called "branch" which is a hashtable. The
hashtable has 1 object of type Tree at key 1 and so on and so forth
(for about 16 layers deep).

I am trying to extract the "count -1" tree but after the first step -
the Branch properies are

*** CODE BEGINS ***

for (int i = 0; i <= count - 1; i++)
{
Tree t1 = (Tree)T.Branch[1];
//T = t;
}


*** CODE ENDS ***



t1 gets populated on the first iteration but the branch property
hashtable is empty! It's like the further object inside here just
disappear. I'm confused! Would appreciate any comments/advice/
suggestions to get this object.

Thanks,
Al.
 
H

Hans Kesting

(e-mail address removed) formulated the question :

A few shots in the dark:
for (int i = 0; i <= count - 1; i++)

You could also write it as "for (int i=0; i<count; i++)". But is does
the same.
{
Tree t1 = (Tree)T.Branch[1];

You are getting a fixed "Branch[1]", did you mean to use "Branch"?
If not, then be aware that a list starts at index 0, so you were trying
to get a *second* element.
//T = t;
}

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top