Hi

assign values to a string[] array in C#

 


string[] tFile = { "file1.txt", "file2.csv", "file3.xlsx" };

Or:


string[] tFile = new string[3]; tFile[0] = "file1.txt"; tFile[1] = "file2.csv"; tFile[2] = "file3.xlsx";

 From a Directory (e.g., all .xlsx files)


string[] tFile = Directory.GetFiles(@"C:\Exports\", "*.xlsx");
Previous
Next Post »