ActiveXMessageFormatter.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 object to serialize is neither a primitive nor a streamed object that implements the OLE IPersistStream interface.

The message parameter is null.

Remarks

The following table shows the relationship between managed types and the BodyType property. The object that you serialize must be one of these managed types or must implement the OLE IPersistStream interface.

BodyType value Managed type
VT_LPSTR Char
VT_BSTR, VT_LPWSTR String
VT_VECTOR | VT_UI1 Byte
VT_BOOL Boolean
VT_CLSID Guid
VT_CY Decimal
VT_DATE DateTime
VT_I1, VT_UI1 Byte
VT_I2 Int16
VT_UI2 UInt16
VT_I4 Int32
VT_UI4 UInt32
VT_I8 Int64
VT_UI8 UInt64
VT_R4 Single
VT_R8 Double
VT_NULL null
VT_STREAMED_OBJECT IPersistStream (OLE) Object

Applies to

See also