Click to See Complete Forum and Search --> : how can this code run exactly


MClear
September 2nd, 2002, 10:21 AM
i try to scan a rootdirectory for all *.dll files inside the root directory including the subdirectories.
i´ve looked for a example and i found one. it works, but i can understand how c# holds the datas in this example.
if you debug this code, you will see that they use an arraylist which is a member variable of the class for each recursion. the arraylist gets a new reference for each directory level, i think, the function should loose the old directory informations and another recursion should not be possible - but is works.
does anybody know why?

greets
markus

Arild Fines
September 3rd, 2002, 04:28 AM
The ArrayList isn't used to store the results of the search - the NameValueCollection found is. And since it is merely added to at each step of the recursion, not reassigned, it works.