| 下午看了下  file类用的时候不容易糊涂  就是path类跟directory类  这样理解对吧 请高人指教 path类 对文件路径(路径就是存储文件的地方 比如c盘下有文件夹test含文档text.txt 那文档的路径就是c:\text)的操作
 string str=System.IO.Path.GetFileName(path);//获得文件名.扩展名 text.txt
 string str1=System.IO.Path.GetExtension(path);//获得扩展名 .txt
 string str2=System.IO.Path.GetFullPath(path);//获得绝对路径 即文件的全名c:\text\text.txt
 string str3=System.IO.Path.GetDirectoryName(path);//获得目录信息 文档存储在的那个路径 c:\text
 directory是对文件夹的操作(比如c盘下的test文件夹里边含有文档test.txt)
 string[] fileName = System.IO.Directory.GetFiles(path, "*.txt");//获得文档c:\test\test.txt
 string[] dir = System.IO.Directory.GetDirectories(path);//获得文件夹 c:\test
 
 |