获取文件夹的创建时间

Posted on 2019-01-07 22:26  努力成长静待花开  阅读(597)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  DirectoryInfo类的CreationTion属性

  public DataTime CreationTime {get;  set;}

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog FBDialog = new FolderBrowserDialog();
            if (FBDialog.ShowDialog() == DialogResult.OK)
            {
                string Path = FBDialog.SelectedPath;
                textBox1.Text = Path;
                label2.Text = "创建时间:" + (new DirectoryInfo(Path)).CreationTime;
            }
        }