CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Posts
    1

    Question how can this code run exactly

    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
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    265
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured