IMessageFormatter IMessageFormatter IMessageFormatter IMessageFormatter Interface

定義

序列化或還原序列化訊息佇列訊息主體中的物件。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
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提供比更快速的XmlMessageFormatter輸送量。BinaryMessageFormatter 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) CanRead(Message) CanRead(Message) CanRead(Message)

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

Clone() Clone() Clone() Clone()

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

(Inherited from ICloneable)
Read(Message) Read(Message) Read(Message) 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) Write(Message, Object) Write(Message, Object) Write(Message, Object)

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

適用於

另請參閱