开发者

Converting Objects to XML representations in C#

开发者 https://www.devze.com 2022-12-09 12:42 出处:网络
I have a dynamic linked library written in C# 3.0. This library has a small set of public classes that I want to make XML representations for. The idea is to allow \"saving/loading\" of objects from d

I have a dynamic linked library written in C# 3.0. This library has a small set of public classes that I want to make XML representations for. The idea is to allow "saving/loading" of objects from disc using XML as the representation. I would also l开发者_高级运维ike to allow users of the class library to pass these XML representations to certain functions of the library as inputs. I have never used XML in this way before so I'm currently in the middle of trying to learn and understand XML.

I have seen quite a bit on the XMLSerializer class online but I'm not sure if that's what I'm looking for because I want to have these objects represented in the program as XML so I can manipulate them in the XML format rather than just writing directly to a file.

Should I define an XSD file? What .Net classes do I need to learn about? Are there any good places to start learning how to do this kind of task?


You can use XmlSerializer with a StringReader and StringWriter to write the XML to a string instead of a file.

0

精彩评论

暂无评论...
验证码 换一张
取 消