这个var result就是list
求指教!
private void button1_Click(object sender, EventArgs e)
{
var dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
var savePath = dialog.SelectedPath;
textBox1.Text = savePath;
var result = Directory
.GetFiles(savePath, "*.txt", SearchOption.AllDirectories)
.Select(x => $"{Path.GetFileName(x)}, 行数:{File.ReadAllLines(x).Length}")
.ToList();
richTextBox1.Text = string.Join(Environment.NewLine, result);
}
}