BinaryMessageFormatter.Read Method (Message)


Reads the contents from the given message and creates an object that contains the deserialized message.

Namespace:   System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

public object Read(
	Message message


Type: System.Messaging.Message

The Message, in binary format, to deserialize.

Return Value

Type: System.Object

The deserialized message.

Exception Condition

The message's BodyType property does not indicate a binary object.


The message parameter is null.

System_CAPS_security Security Note

Calling this method with untrusted data is a security risk. Call this method only with trusted data. For more information, see Untrusted Data Security Risks.

The body of the message must be in binary format, and the same serializer must be used to deserialize the message as that which initially serialized it. If the body represents a custom class, the assembly for that class must exist locally.

.NET Framework
Available since 1.1
Return to top