DataContractSerializer.WriteObject 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将所有对象数据(开始 XML 元素、内容和结束元素)写入 XML 文档或流。
重载
WriteObject(XmlWriter, Object) |
使用 XmlWriter 将所有对象数据(开始 XML 元素、内容和结束元素)写入 XML 文档或流。 |
WriteObject(XmlDictionaryWriter, Object, DataContractResolver) |
使用指定的 XmlDictionaryWriter 将 (起始 XML 元素、内容和封闭元素) 的所有对象数据写入 XML 文档或流。 此方法包含用于在运行时映射 |
WriteObject(XmlWriter, Object)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
使用 XmlWriter 将所有对象数据(开始 XML 元素、内容和结束元素)写入 XML 文档或流。
public:
override void WriteObject(System::Xml::XmlWriter ^ writer, System::Object ^ graph);
public override void WriteObject (System.Xml.XmlWriter writer, object graph);
public override void WriteObject (System.Xml.XmlWriter writer, object? graph);
override this.WriteObject : System.Xml.XmlWriter * obj -> unit
Public Overrides Sub WriteObject (writer As XmlWriter, graph As Object)
参数
- graph
- Object
包含要写入流的数据的对象。
例外
正在序列化的类型不符合数据协定规则。 例如,DataContractAttribute 特性未应用于该类型。
正在写入的实例出现问题。
适用于
WriteObject(XmlDictionaryWriter, Object, DataContractResolver)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
使用指定的 XmlDictionaryWriter 将 (起始 XML 元素、内容和封闭元素) 的所有对象数据写入 XML 文档或流。 此方法包含用于在运行时映射 xsi:type
声明的解析器。
public:
void WriteObject(System::Xml::XmlDictionaryWriter ^ writer, System::Object ^ graph, System::Runtime::Serialization::DataContractResolver ^ dataContractResolver);
public void WriteObject (System.Xml.XmlDictionaryWriter writer, object? graph, System.Runtime.Serialization.DataContractResolver? dataContractResolver);
public void WriteObject (System.Xml.XmlDictionaryWriter writer, object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver);
override this.WriteObject : System.Xml.XmlDictionaryWriter * obj * System.Runtime.Serialization.DataContractResolver -> unit
Public Sub WriteObject (writer As XmlDictionaryWriter, graph As Object, dataContractResolver As DataContractResolver)
参数
- writer
- XmlDictionaryWriter
用于将内容写入 XML 文档或流的 XmlDictionaryWriter。
- graph
- Object
包含要写入的内容的对象。
- dataContractResolver
- DataContractResolver
用于将 xsi:type
声明映射到已知数据协定的 DataContractResolver 的实现。