1. 程式人生 > >獲取資料夾的建立時間

獲取資料夾的建立時間

實現效果:

  

知識運用:

  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;
            }
        }