Tuesday, May 27, 2008

Recurse directories with C#

I'm working on a C# program that recurses through directories, adding all the files to a list (I felt like trying out C#, and this was a good place to start). I found this VB.NET program doing something very similar, and adapted it to C#.

private void recurseDirs(String rootdir) {
DirectoryInfo dirinfo = new DirectoryInfo(rootdir);
foreach(FileInfo fi in dirinfo.GetFiles()){
foreach(DirectoryInfo di in dirinfo.GetDirectories()){

No comments: