欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#下實(shí)現(xiàn)創(chuàng)建和刪除目錄的實(shí)例代碼

 更新時(shí)間:2014年08月12日 11:28:28   投稿:shichen2014  
這篇文章主要介紹了C#下實(shí)現(xiàn)創(chuàng)建和刪除目錄的方法,功能非常實(shí)用,需要的朋友可以參考下

本文所述代碼是從一個(gè)C#程序中摘錄出來的,主要實(shí)現(xiàn)C#創(chuàng)建目錄、刪除文件夾及文件的功能,包括所引用的名稱空間等,特別是對C#不熟悉的初學(xué)者,會(huì)有一定的參考借鑒價(jià)值。下面把創(chuàng)建和刪除文件夾的完整代碼帖上來供大家參考借鑒。

代碼入下所示:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;
namespace delete
{
  class Program
  {
    static void Main(string[] args)
    {
      deleteFiles(@"D:\Test\我的文件夾");
    }
    public static void deleteFiles(string strDir)
    {
      if (Directory.Exists(strDir))
      {
        Directory.Delete(strDir, true);
        Directory.CreateDirectory(strDir);
        Console.WriteLine("文件刪除成功!");
        Console.ReadLine();
      }
      else
      {
        Directory.CreateDirectory(strDir);
        Console.WriteLine("文件夾創(chuàng)建成功!");
        Console.ReadLine();
      }
    }
  }
}

相信本文所述實(shí)例會(huì)對大家有一定的幫助。

相關(guān)文章

最新評論