System.Runtime.Serialization.ISerializable.GetObjectData Method

Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.

Syntax

public void GetObjectData (SerializationInfo info, StreamingContext context)

Parameters

info
The System.Runtime.Serialization.SerializationInfo to populate with data.
context
The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

Remarks

Any objects that are included in the System.Runtime.Serialization.SerializationInfo are automatically tracked and serialized by the formatter.

Code that calls ISerializable.GetObjectData(SerializationInfo, StreamingContext) requires the System.Security.Permissions.SecurityPermission for providing serialization services. Associated enumeration: System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter.

Note:

It is not guaranteed that this method will be called only once per object instance during serialization. Therefore, the method should be implemented in such a way that its behavior will be the same regardless of the number of times it is called.

Requirements

Namespace: System.Runtime.Serialization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0