简体   繁体   English

如何将对象另存为XML文件

[英]How can I save objects as XML files

I'm working on my high-school matriculation asp.net project, and I wish to make a website of a bookstore. 我正在从事高中预科课程asp.net项目,并且希望建立一个书店网站。

I want to create two classes, Book and BookStore , and save the data created in XML files and not in a database. 我想创建两个类BookBookStore ,并将创建的数据保存在XML文件而不是数据库中。

How can I save objects as XML files, and how can I load them afterwards? 如何将对象另存为XML文件,以及之后如何加载它们?

Thank you very much. 非常感谢你。

You need to use XML serialisation. 您需要使用XML序列化。 There are tons of examples of how to do this, but here's one link for you to get started: 有大量的示例说明了如何执行此操作,但是以下是您入门的一个链接:

http://devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=236 http://devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=236

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM