C#讀取文件夾下面的全部文件的實(shí)現(xiàn)
作者:飛翔的豬 
  C#讀取文件夾下面的全部文件夾主要向你介紹了C#讀取文件夾方面的實(shí)現(xiàn)操作代碼。希望對(duì)你學(xué)習(xí)C#讀取文件夾有所幫助。
 C#讀取文件夾下面的全部文件夾是如何實(shí)現(xiàn)的呢?那讓我們來(lái)看看下面的代碼的實(shí)現(xiàn):
- private void button1_Click(object sender, EventArgs e)
 - {
 - string QQPath;
 - using (RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"Software\Tencent\QQ"))
 - {
 - QQPath = reg.GetValue("Install").ToString();
 - }
 - textBox1.Text = QQPath; //C#讀取文件夾下面的全部文件夾
 - Get_Folder(QQPath);
 - }
 - private void Get_Folder(string FilePath)
 - {
 - if (Directory.Exists(FilePath))
 - {
 - foreach (string d in Directory.GetFileSystemEntries(FilePath))
 - {
 - if (Directory.Exists(d))
 - {
 - listBox1.Items.Add(d.ToString());
 - }
 - } //C#讀取文件夾下面的全部文件夾
 - }
 - else
 - {
 - MessageBox.Show("文件夾不存在!");
 - }
 - }
 
C#讀取文件夾下面的全部文件夾的基本情況就向你介紹到這里,希望對(duì)你學(xué)習(xí)C#讀取文件夾下面的全部文件夾有所幫助。
【編輯推薦】
責(zé)任編輯:仲衡 
                    來(lái)源:
                    百度空間
 














 
 
 
 
 
 
 