Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)
Thetype exposes the following members.
The interface provides a single property that sets or returns a structure used to store data that is external to a data contract. The extra data is stored in an instance of the ExtensionDataObject class and accessed through the ExtensionData property. In a roundtrip operation where data is received, processed, and sent back, the extra data is sent back to the original sender intact. This is useful to store data received from future versions of the contract. If you do not implement the interface, any extra data is ignored and discarded during a roundtrip operation.
To use this versioning feature
Implement the interface in a class.
Add the ExtensionData property to your type.
Add a private member of type ExtensionDataObject to the class.
Implement get and set methods for the property using the new private member.
For more information about versioning of types, see Data Contract Versioning. For information about creating forward-compatible data contracts, see Forward Compatible Data Contracts. For more information about data contracts, see Using Data Contracts.
The following code shows an instance of a type (PersonVersion2) that is the second version of a serializable type (Person). The second version contains extra data (ID field) that is not present in the first version.
' Implement the IExtensibleDataObject interface ' to store the extra data for future versions. <DataContract(Name := "Person", [Namespace] := "http://www.cohowinery.com/employees")> _ Class Person Implements IExtensibleDataObject ' To implement the IExtensibleDataObject interface, ' you must implement the ExtensionData property. The property ' holds data from future versions of the class for backward ' compatibility. Private extensionDataObject_value As ExtensionDataObject Public Property ExtensionData() As ExtensionDataObject _ Implements IExtensibleDataObject.ExtensionData Get Return extensionDataObject_value End Get Set extensionDataObject_value = value End Set End Property <DataMember()> _ Public Name As String End Class ' The second version of the class adds a new field. The field's ' data is stored in the ExtensionDataObject field of ' the first version (Person). You must also set the Name property ' of the DataContractAttribute to match the first version. ' If necessary, also set the Namespace property so that the ' name of the contracts is the same. <DataContract(Name := "Person", [Namespace] := "http://www.cohowinery.com/employees")> _ Class PersonVersion2 Implements IExtensibleDataObject ' Best practice: add an Order number to new members. <DataMember(Order:=2)> _ Public ID As Integer <DataMember()> _ Public Name As String Private extensionDataObject_value As ExtensionDataObject Public Property ExtensionData() As ExtensionDataObject _ Implements IExtensibleDataObject.ExtensionData Get Return extensionDataObject_value End Get Set extensionDataObject_value = value End Set End Property End Class
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.