ActiveXMessageFormatter.Read(Message) ActiveXMessageFormatter.Read(Message) ActiveXMessageFormatter.Read(Message) Method

定義

讀取指定訊息的內容,並建立包含還原序列化訊息的物件。Reads the contents from the given message and creates an object that contains the deserialized message.

public:
 virtual System::Object ^ Read(System::Messaging::Message ^ message);
public object Read (System.Messaging.Message message);
abstract member Read : System.Messaging.Message -> obj
override this.Read : System.Messaging.Message -> obj

參數

message
Message Message Message

要還原序列化的 Message,格式為 MSMQ ActiveX 控制項。The Message, in MSMQ ActiveX control format, to deserialize.

傳回

還原序列化的訊息。The deserialized message.

實作

例外狀況

messageBodyType 屬性傳遞的參數無法對應至基本型別,它也不表示一個資料流物件。The BodyType property of the message passed as a parameter cannot be mapped to a primitive type, nor does it represent a streamed object.

主體表示一個預存物件。The body represents a stored object. ActiveXMessageFormatter 不支援儲存物件的還原序列化 (Deserialization) 格式。The ActiveXMessageFormatter does not support deserialization of stored objects.

message 參數為 nullThe message parameter is null.

備註

如果訊息的本文代表基本型別, 則訊息的BodyType屬性必須是下表中的其中一個 managed 型別。If the body of the message represents a primitive type, the message's BodyType property must be one of the managed types in the following table.

BodyType 值BodyType value Managed 類型Managed type
VT_LPSTRVT_LPSTR Chararray (使用 ASCII 編碼進行還原序列化)Char array (deserialized using ASCII encoding)
VT_BSTR, VT_LPWSTRVT_BSTR, VT_LPWSTR String(使用 Unicode 編碼進行還原序列化)String (deserialized using Unicode encoding)
VT_VECTOR | VT_UI1VT_VECTOR | VT_UI1 Byte 陣列Byte array
VT_BOOLVT_BOOL Boolean
VT_CLSIDVT_CLSID Guid
VT_CYVT_CY Decimal
VT_DATEVT_DATE DateTime
VT_I1, VT_UI1VT_I1, VT_UI1 Byte
VT_I2VT_I2 Int16
VT_UI2VT_UI2 UInt16
VT_I4VT_I4 Int32
VT_UI4VT_UI4 UInt32
VT_I8VT_I8 Int64
VT_UI8VT_UI8 UInt64
VT_R4VT_R4 Single
VT_R8VT_R8 Double
VT_NULLVT_NULL null
VT_STREAMED_OBJECTVT_STREAMED_OBJECT Object

適用於

另請參閱