⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.cs

📁 csharp课本的源代码
💻 CS
字号:
using System;
using System.IO;
class Test
{
    public static void Main()
    {
        //指定要操作的目录
        string path = @"c:\MyDir";
        try
        {
            //确定目录是否存在
            if (Directory.Exists(path))
            {
                Console.WriteLine("目录已存在");
                return;
            }
            //建立目录
            DirectoryInfo di = Directory.CreateDirectory(path);
            Console.WriteLine("成功创建目录:{0}",
                Directory.GetCreationTime(path));
            //删除目录
            di.Delete();
            Console.WriteLine("目录已删除");
        }
        catch (Exception e)
        {
            Console.WriteLine("程序异常: {0}", e.ToString());
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -