将自定义DataSet中的字段序列化为XML [英] Serializing fields in a custom DataSet to XML

查看:316
本文介绍了将自定义DataSet中的字段序列化为XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法向DataSet添加字段,当DataSet以XML格式化时,它将与表信息一起序列化?我有一些描述DataSet的信息,当我把它放在XML中时,我想尝试包含它。我已经尝试在Visual Studio生成的部分类中添加字段和类,用于验证方法,但是当我的myDataSet.WriteXML()或我使用的时候,我似乎无法让它们与XML文件中的表信息一起显示一个XMLSerializer。

Is there any way to add fields to a DataSet which will be serialized along with the table information when the DataSet is serialized in XML? I have some information that describes the DataSet that I want to try to include inside it when I throw it around in XML. I've tried adding fields and classes in the partial class Visual Studio generates for you for validation methods but I can't seem to get them to show up alongside the table information in the XML file either when myDataSet.WriteXML() or I use an XMLSerializer.

推荐答案

我还没有尝试过,但是 DataSet的ExtendedProperties 属性应该只是为了这个。它允许您存储当DataSet序列化为XML时持久存储的信息。

I haven't ever tried it, but the ExtendedProperties property of DataSet is supposed to be just for this. It lets you store information which is persisted when the DataSet is serialised to XML.

这篇关于将自定义DataSet中的字段序列化为XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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