Program
using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main() { String []dirs = Directory.GetDirectories("D:/Sample"); Console.WriteLine("Sub directories are:"); for (int i = 0; i < dirs.Length; i++) { Console.WriteLine("\t"+dirs[i]); } } } }
Output
Sub directories are: D:/Sample\Blue Color D:/Sample\Blue Whale D:/Sample\Green color D:/Sample\Green vegetable D:/Sample\Red color
Note: In above program, we need to remember, when we use "Directory" class, System.IO namespace must be included in the program.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Program
Output
Sub directories are: D:/Sample\Blue Color D:/Sample\Blue Whale D:/Sample\Green color D:/Sample\Green vegetable D:/Sample\Red colorNote: In above program, we need to remember, when we use "Directory" class, System.IO namespace must be included in the program.
need an explanation for this answer? contact us directly to get an explanation for this answer