在Window项目中创建XML文件 [英] Create XML file in Window project

查看:114
本文介绍了在Window项目中创建XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Window项目中创建一个XML文件。

我尝试下面的代码



XElement xml = new XElement(人员,新XElement(人员,新XElement(姓名,姓名1),新XElement(城市,城市),新XElement(年龄,20));

xml.Save(XMLFile.xml);

MessageBox.Show(XML文件已创建!);



但我找不到,xml文件保存在哪里。

I want to create a XML file in my Window project.
I trying below code

XElement xml = new XElement("Persons",new XElement("Person",new XElement("Name", "Name1"),new XElement("City", "City"),new XElement("Age","20")));
xml.Save("XMLFile.xml");
MessageBox.Show("XML File created ! ");

but i do't find, where xml file is save.

推荐答案

你的文件是在 bin / debug / 文件夹中创建的您的项目。
Your file is created in bin/debug/ folder of your project.


您好,

正如Tarun所说,XML是在bin\debug文件夹中创建的。您可以通过提供必须保存的确切文件路径来覆盖特定路径

Hi,
As Tarun said, the XML is created in bin\debug Folder. You can overwrite to Specific path by giving the exact file path where it has to be saved
xml.Save(@"D:\TempLogFilePath\XMLFile.xml");


这篇关于在Window项目中创建XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆