IMessageFormatter 介面

定義

序列化或還原序列化訊息佇列訊息主體中的物件。Serializes or deserializes objects from the body of a Message Queuing message.

public interface class IMessageFormatter : ICloneable
[System.ComponentModel.TypeConverter(typeof(System.Messaging.Design.MessageFormatterConverter))]
public interface IMessageFormatter : ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Messaging.Design.MessageFormatterConverter))>]
type IMessageFormatter = interface
    interface ICloneable
Public Interface IMessageFormatter
Implements ICloneable
衍生
屬性
實作

備註

當應用程式使用類別的實例,將訊息傳送至佇列時 MessageQueue ,格式器會將物件序列化 (它可以是任何類別的實例) 到資料流程中,然後將它插入訊息主體中。When an application sends a message to the queue using an instance of the MessageQueue class, the formatter serializes the object (which can be an instance of any class) into a stream and inserts it into the message body. 使用從佇列讀取時 MessageQueue ,格式器會將訊息資料還原序列化為的 Body 屬性 MessageWhen reading from a queue using a MessageQueue, the formatter deserializes the message data into the Body property of a Message.

BinaryMessageFormatterActiveXMessageFormatter提供比更快的輸送量 XmlMessageFormatterBinaryMessageFormatter and ActiveXMessageFormatter provide faster throughput than the XmlMessageFormatter. ActiveXMessageFormatter允許與 Visual Basic 6.0 訊息佇列應用程式之間的互通性。The ActiveXMessageFormatter allows interoperability with Visual Basic 6.0 Message Queuing applications. XmlMessageFormatter是鬆散結合的,這表示伺服器和用戶端可以針對個別傳送和接收的型別進行版本。The XmlMessageFormatter is loosely coupled, which means that the server and client can version the type that is sent and received independently.

方法

CanRead(Message)

在類別內實作時,決定格式子是否可以將訊息的內容還原序列化。When implemented in a class, determines whether the formatter can deserialize the contents of the message.

Clone()

建立目前執行個體複本的新物件。Creates a new object that is a copy of the current instance.

(繼承來源 ICloneable)
Read(Message)

在類別內實作時,讀取指定訊息的內容,並建立含有訊息資料的物件。When implemented in a class, reads the contents from the given message and creates an object that contains data from the message.

Write(Message, Object)

在類別內實作時,將物件序列化到訊息主體中。When implemented in a class, serializes an object into the body of the message.

適用於

另請參閱