-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Sampath_Kumar
Message 3 in Discussion
If you just want to get in to all the directories and sub directories . Try level
order traversal a -- b -----c --d ----e ----f if you need a a b a b c a d a d e a
d f You could use recursion. But it might eat a lot of resources if the directory is
too deep. A good idea is to simulate recursion. if you need a a b a d a b c a d e
a d f You can try level order traversal. This needs only iteration and not recursion
.
private void LevelOrder ( String strDirName )
{
System.Collections.Queue qList = new System.Collections.Queue () ;
qList.Enqueue ( strDirName ) ;
while ( qList.Count > 0 )
{
String curDir = qList.Dequeue().ToString () ;
DirectoryInfo diInfo = new DirectoryInfo ( curDir ) ;
Console.WriteLine ( curDir ) ;
foreach ( DirectoryInfo dSubDir in diInfo.GetDirectories () )
qList.Enqueue ( dSubDir.FullName ) ;
}
}
Regards
Sampath
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]