Uredi

Deli z drugimi prek


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
Public Sub Write (message As Message, obj As Object)

Parameters

message
Message

The Message whose Body property will contain the serialized object.

obj
Object

The object to be serialized into the message body.

Implements

Exceptions

The message parameter is null.

Remarks

Important

Calling this method with untrusted data is a security risk. Call this method only with trusted data. For more information, see Validate All Inputs.

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