Redigera

Dela via


XmlMessageFormatter.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.

-or-

The obj parameter is null.

Remarks

The target types need not be specified to write to the queue as they must be when reading. The TargetTypeNames or TargetTypes property is used by the formatter only when deserializing a message.

The XmlMessageFormatter makes use of the XmlSerializer class, which defines what can be serialized. Only public fields and public properties can be serialized. Structures, structures with arrays, and arrays of structures are all serializable, as long as they do not use the encoded style with the SOAP protocol.

Applies to

See also