当前位置:编程学习 > C#/ASP.NET >>

判断目录是否有此文件


XmlDocument xmlDoc = new XmlDocument();
            XmlDeclaration dec = xmlDoc.CreateXmlDeclaration("1.0", "GB2312", null);
            xmlDoc.AppendChild(dec);
            XmlElement root = xmlDoc.CreateElement("book");
            xmlDoc.AppendChild(root);
            xmlDoc.Save("c:/test.xml");
            Console.Write(xmlDoc.OuterXml);


上面的代码是我在打开每个页面的时候就要运行的,我想问下怎么判断此目录是否有此文件? --------------------编程问答-------------------- File.Exist(file) --------------------编程问答-------------------- system.io.file.exists --------------------编程问答--------------------
引用 1 楼 dancingbit 的回复:
File.Exist(file)


+1 --------------------编程问答--------------------
引用 2 楼 shushukui 的回复:
system.io.file.exists
 正解 --------------------编程问答-------------------- 正确 蹭分 --------------------编程问答--------------------
引用楼主 nolan0306 的回复:
C# code

XmlDocument xmlDoc = new XmlDocument();
            XmlDeclaration dec = xmlDoc.CreateXmlDeclaration("1.0", "GB2312", null);
            xmlDoc.AppendChild(dec);
            XmlElement r……

40秒就拿分了,赞一个 --------------------编程问答-------------------- File.Exist(Server.mapPath("~/")+file) --------------------编程问答-------------------- if(File.Exist(文件路径)) --------------------编程问答-------------------- 以上的都是正解,呵呵,FILE.Exits(); --------------------编程问答-------------------- --------------------编程问答-------------------- if(File.Exist(文件路径)) --------------------编程问答-------------------- 我都服了
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,