Sure you can:
string directory = @"C:\";
List<string> textFiles = System.IO.Directory.GetFiles(directory, "*.txt").ToList();
// You can now you textFiles as a DataSource for your List Control
you can add using System.IO
directive and remove it from the above code;
1
solved C# – Display Files in a Folder on Button Click [closed]