using System;标签:file,Console,string,C#,System,目录,WriteLine,subFiles,列出 From: https://blog.51cto.com/u_14650780/5998724
using System.IO;namespace 目录
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
ListFiles("G:");
}
public static void ListFiles(string pathname)
{
string[] subFiles = Directory.GetFiles(pathname);
int i = 0;
foreach (string file in subFiles)
{
i++;
Console.WriteLine(file);
}
Console.WriteLine("累计:" + i);
}
}
}