ComponentSerializationService::SerializeAbsolute Method (SerializationStore^, Object^)

 

Serializes the given object, accounting for default property values.

Namespace:   System.ComponentModel.Design.Serialization
Assembly:  System (in System.dll)

public:
virtual void SerializeAbsolute(
	SerializationStore^ store,
	Object^ value
) abstract

Parameters

store
Type: System.ComponentModel.Design.Serialization::SerializationStore^

The SerializationStore to which the state of value will be serialized.

value
Type: System::Object^

The object to serialize.

Exception Condition
ArgumentNullException

store or value is null.

InvalidOperationException

store is closed, or store is not a supported type of serialization store. Use a store returned by CreateStore.

Standard serialization, as implemented through the Serialize method, only serializes values that differ from the component's default state. This provides the most compact serialization mechanism but assumes that a newly created object will be used during deserialization. If an existing object is used, the resulting deserialized object is not guaranteed to duplicate the original state of the serialized object; the properties that contained default values during serialization will not be reset back to their defaults during deserialization.

The SerializeAbsolute method does not use this shortcut. It serializes all properties of the source object so that deserialization can restore all the object's properties, regardless of default state.

This method is particularly useful for serializing collections, because the order of the constituent items within the collection can change. In this circumstance, the safest process to restore the original state of the entire collection is to overwrite all the items with all their original property values.

.NET Framework
Available since 2.0
Return to top
Show: