根据日期动态建立文件

实现效果:

  

知识运用:

  DateTime结构的Now属性

  File类的Create方法

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fb = new FolderBrowserDialog();
            if (fb.ShowDialog() == DialogResult.OK) 
            {
                string fileName = DateTime.Now.ToString("yyyyMMdd-hhmmss")+".txt";
                File.Create(fb.SelectedPath+"\"+fileName);
            }
        }
原文地址:https://www.cnblogs.com/feiyucha/p/10217358.html