XmlElementEventArgs.ObjectBeingDeserialized 属性

定义

获取 XmlSerializer 正在反序列化的对象。Gets the object the XmlSerializer is deserializing.

public:
 property System::Object ^ ObjectBeingDeserialized { System::Object ^ get(); };
public object ObjectBeingDeserialized { get; }
member this.ObjectBeingDeserialized : obj
Public ReadOnly Property ObjectBeingDeserialized As Object

属性值

XmlSerializer 正在反序列化的对象。The object that is being deserialized by the XmlSerializer.

示例

下面的示例从名为 UnknownElements 的文件中对名为 Group 的类进行反序列化。The following example deserializes a class named Group from a file named UnknownElements.xml. 只要在文件中找到了类中没有相应成员的元素,就会发生 UnknownElement 事件。Whenever an element is found in the file that has no corresponding member in the class, the UnknownElement event occurs. 若要尝试该示例,请将以下 XML 代码粘贴到名为 UnknownElements 的文件中。To try the example, paste the following XML code into a file named UnknownElements.xml.

<?xml version="1.0" encoding="utf-8"?>  
<Group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
  <GroupName>MyGroup</GroupName>  
  <GroupSize>Large</GroupSize>  
  <GroupNumber>444</GroupNumber>  
  <GroupBase>West</GroupBase>  
</Group>  

XmlSerializer。 UnknownElement 示例 # 1XmlSerializer.UnknownElement Example#1

适用于