C#C
C#2y ago
js

problem with console writeline

Console.WriteLine("Please select a file to load.");

string[] filePaths = Directory.GetFiles(@"C:\Users\Joe\Documents\Uni\Programming Portfolio\Summative4\Summative4", "*.mark");

int count1 = 1;

foreach (string file in filePaths)
{
    Console.WriteLine($"{count1}. ",Path.GetFileName(file));
    count1 = count1 + 1;
}
string selectedFile = Console.ReadLine();

when i run the program its printing all the filenames fine but not the number before each file (count1)
image.png
Was this page helpful?