ExtensionDataObject Class


Stores data from a versioned data contract that has been extended by adding new members.

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


type ExtensionDataObject = class end


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Returns a string that represents the current object.(Inherited from Object.)

The ExtensionDataObject is the structure that stores extra data encountered by the XmlObjectSerializer during deserialization operations. The structure is used by serialization to write the extra data into the serialized instance. The structure is returned by the ExtensionData property of the IExtensibleDataObject interface.

The following code serializes an instance of a type (PersonVersion2) that is the second version of the serializable type (Person). The second version contains extra data (ID field) that is not present in the first version. The code then deserializes the XML document into a Person object, then immediately reserializes the object including the extra data. Finally, the code deserializes the new XML into a PersonVersion2 object and writes the complete data to the console, proving that the data has made a round trip to and from an older version of the type. Note that the DataContractAttribute attribute must be applied with the Name and Namespace properties set to the same name and namespace as the original class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top