แก้ไข

แชร์ผ่าน


ComponentSerializationService.SerializeAbsolute Method

Definition

Serializes the given object, accounting for default property values.

public:
 abstract void SerializeAbsolute(System::ComponentModel::Design::Serialization::SerializationStore ^ store, System::Object ^ value);
public abstract void SerializeAbsolute (System.ComponentModel.Design.Serialization.SerializationStore store, object value);
abstract member SerializeAbsolute : System.ComponentModel.Design.Serialization.SerializationStore * obj -> unit
Public MustOverride Sub SerializeAbsolute (store As SerializationStore, value As Object)

Parameters

store
SerializationStore

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

value
Object

The object to serialize.

Exceptions

store or value is null.

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

Remarks

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.

Applies to

See also