Display directory Learn programming C#

Lesson:

Additional Libraries


Exercise:

Display directory


Objetive:

Create a program that shows the files in the current folder.


Code:

using System;
using System.IO;
class DisplayDirectory
{
    static void Main()
    {
        string[] files = Directory.GetFiles(".");

        foreach (string file in files)
        {
            Console.WriteLine(file);
        }
    }
}

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.