ISerializationSurrogate.SetObjectData Method (Object, SerializationInfo, StreamingContext, ISurrogateSelector)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Populates the object using the information in the SerializationInfo.

Namespace:   System.Runtime.Serialization
Assembly:  mscorlib (in mscorlib.dll)

object SetObjectData(
	object obj,
	SerializationInfo info,
	StreamingContext context,
	ISurrogateSelector selector


Type: System.Object

The object to populate.

Type: System.Runtime.Serialization.SerializationInfo

The information to populate the object.

Type: System.Runtime.Serialization.StreamingContext

The source from which the object is deserialized.

Type: System.Runtime.Serialization.ISurrogateSelector

The surrogate selector where the search for a compatible surrogate begins.

Return Value

Type: System.Object

The populated deserialized object.

Exception Condition

The caller does not have the required permission.

The SetObjectData method is called during deserialization. With this method, you can take the empty Objectobj that has already been created, and enter SerializationInfoinfo data into that object. Constructors are not invoked during deserialization of information and reconstruction of the object.

This method is protected by a SecurityAction.LinkDemand for the SecurityPermission with the SecurityPermissionFlag.SerializationFormatter specified.

.NET Framework
Available since 1.1
Return to top