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

📄 sample8.cs

📁 C#函数手册
💻 CS
字号:
namespace apiBook
{
	using System;
	using System.IO;	
	public class TestFileStreamInfoClass
	{
		public static void Main() 
		{				

			string path="C:\\language\\C#";
			Directory.CreateDirectory(path);
			Console.WriteLine("系统是否存在目录"+path+"?"+Directory.Exists(path));	
			FileSystemInfo testFSI=new DirectoryInfo(path);
			testFSI.Delete();
			//使用Delete方法删除目录
			testFSI.Refresh();
			//使用Refresh方法刷新对象
			Console.WriteLine("执行删除目录操作");
			Console.WriteLine("系统是否存在目录"+path+"?"+Directory.Exists(path));	
			Console.WriteLine();
			path="C:\\language\\testFSI.txt";
			FileStream testFS=File.Create(path);
			testFS.Close();
			testFSI=new FileInfo(path);
			Console.WriteLine("系统是否存在文件"+path+"?"+File.Exists(path));		
			testFSI.Delete();	
			//使用Delete方法删除文件
			testFSI.Refresh();
			//使用Refresh方法刷新对象
			Console.WriteLine("执行删除文件操作");
			Console.WriteLine("系统是否存在文件"+path+"?"+File.Exists(path));				
		}
	}
}

⌨️ 快捷键说明

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