判断目录是否有此文件
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 --------------------编程问答-------------------- 正解 --------------------编程问答-------------------- 正确 蹭分 --------------------编程问答--------------------
40秒就拿分了,赞一个 --------------------编程问答-------------------- File.Exist(Server.mapPath("~/")+file) --------------------编程问答-------------------- if(File.Exist(文件路径)) --------------------编程问答-------------------- 以上的都是正解,呵呵,FILE.Exits(); --------------------编程问答-------------------- --------------------编程问答-------------------- if(File.Exist(文件路径)) --------------------编程问答-------------------- 我都服了
补充:.NET技术 , C#