UnreferencedObjectEventArgs.UnreferencedObject Property

 

Gets the deserialized, but unreferenced, object.

Namespace:   System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)

member UnreferencedObject : Object with get

Property Value

Type: System.Object

The deserialized, but unreferenced, object.

The UnreferencedObject can be cast to the known type if examining its properties is required.

See the UnreferencedObject event for more information about the UnreferencedObject property.

The following example adds an UnreferencedObjectEventHandler to an XmlSerializer. The event is handled by the Serializer_UnreferencedObject method. To run the example, cut and paste the following XML into a file named UnrefObj.xml.

<wrapper>
  <Group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="id1" n1:GroupName=".NET" xmlns:n1="http://www.cpandl.com">
   </Group>
<Vehicle id="id2" n1:type="Vehicle" xmlns:n1="http://www.w3.org/2001/XMLSchema-instance">
    <licenseNumber xmlns:q1="http://www.w3.org/2001/XMLSchema" n1:type="q1:string">ABCD</licenseNumber>
  </Vehicle>
<Vehicle id="id3" n1:type="Vehicle" xmlns:n1="http://www.w3.org/2001/XMLSchema-instance">
    <licenseNumber xmlns:q1="http://www.w3.org/2001/XMLSchema" n1:type="q1:string">1234</licenseNumber>
  </Vehicle>
</wrapper>
No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: