BinaryMessageFormatter.Write(Message, Object) BinaryMessageFormatter.Write(Message, Object) BinaryMessageFormatter.Write(Message, Object) Method

Definition

Serializes an object into the body of the message.

public:
 virtual void Write(System::Messaging::Message ^ message, System::Object ^ obj);
public void Write (System.Messaging.Message message, object obj);
abstract member Write : System.Messaging.Message * obj -> unit
override this.Write : System.Messaging.Message * obj -> unit

Parameters

message
Message Message Message

The Message whose Body property will contain the serialized object.

obj
Object Object Object

The object to be serialized into the message body.

Implements

Exceptions

Remarks

Important

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

The top object format and type format need not be specified to write to the queue as they must be when reading. The TopObjectFormat and TypeFormat properties are used by the formatter only when deserializing a message.

The BinaryMessageFormatter can serialize most objects, but the result is not loosely coupled. However, it is compact, so the formatter is efficient for large objects.

Applies to

See also