IDataContractSurrogate::GetObjectToSerialize Method (Object^, Type^)
During serialization, returns an object that substitutes the specified object.
Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)
Parameters
- obj
-
Type:
System::Object^
The object to substitute.
- targetType
-
Type:
System::Type^
The Type that the substituted object should be assigned to.
Return Value
Type: System::Object^The substituted object that will be serialized. The object must be serializable by the DataContractSerializer. For example, it must be marked with the DataContractAttribute attribute or other mechanisms that the serializer recognizes.
This method must not return null because on deserialization the data will be cast to type Object and an InvalidCastException is thrown.
Available since 3.0