DirectoryInfo info = new DirectoryInfo("C:\\MySpace"); IEnumerable<directoryinfo> var = info.EnumerateDirectories();</directoryinfo>
//WAY 1 int iCount =0; DirectoryInfo diSource = new DirectoryInfo(sourceDirectory); DirectoryInfo[] disSubFolders = diSource.GetDirectories(); iCount = disSubFolders.Length; //WAY 2 int iCount =0; DirectoryInfo diSource = new DirectoryInfo(sourceDirectory); foreach (DirectoryInfo di in diSource) { iCount ++; //Can do anything else too if needed. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)