Редагувати

Поділитися через


IDesignerSerializationManager.SerializationComplete Event

Definition

Occurs when serialization is complete.

public:
 event EventHandler ^ SerializationComplete;
event EventHandler SerializationComplete;
member this.SerializationComplete : EventHandler 
Event SerializationComplete As EventHandler 

Event Type

Remarks

This event is raised when serialization or deserialization is complete.

Generally, serialization code is written to emit serialization data and does not typically require state-related checking and processing. If it is necessary to maintain state data throughout serialization, data can be set and accessed by a serializer, which can listen to the SerializationComplete event, and clear the data after serialization. Restoring the proper state after serialization can be important because serializers can be reused during serialization, and leftover state data or open streams might not be correct.

For example, if a serializer needs to write to another file, such as a resource file, it is inefficient to design the serializer to close the file when finished. Serializing an object graph usually requires several serializers. The resource file would be opened and closed many times. Instead, the resource file can be closed at the end of serialization by an object that listened to the SerializationComplete event.

Applies to