ActiveXMessageFormatter 类

定义

使用与 MSMQ ActiveX 组件兼容的格式,将基元数据类型和其他对象序列化成“消息队列”消息体或从“消息队列”消息体反序列化基元数据类型和其他对象。Serializes or deserializes primitive data types and other objects to or from the body of a Message Queuing message, using a format that is compatible with the MSMQ ActiveX Component.

public ref class ActiveXMessageFormatter : ICloneable, System::Messaging::IMessageFormatter
public class ActiveXMessageFormatter : ICloneable, System.Messaging.IMessageFormatter
type ActiveXMessageFormatter = class
    interface IMessageFormatter
    interface ICloneable
Public Class ActiveXMessageFormatter
Implements ICloneable, IMessageFormatter
继承
ActiveXMessageFormatter
实现

注解

ActiveXMessageFormatter与使用消息队列 com 组件发送的消息兼容, 允许与使用 MSMQ COM 控件的应用程序进行互操作。The ActiveXMessageFormatter is compatible with messages sent using Message Queuing COM components, allowing interoperability with applications that use the MSMQ COM control.

可以序列化大多数基元以及IPersistStream实现 OLE 接口的对象。 ActiveXMessageFormatterThe ActiveXMessageFormatter can serialize most primitives, as well as objects that implement the IPersistStream OLE interface. 它可以反序列化同一组基元, 但当反序列化 COM 对象 (例如使用 Visual Basic 6.0 创建的对象, 该对象使用实现IPersistStream的对象) 时需要进一步的工作。It can deserialize the same set of primitives, but requires further effort when deserializing a COM object (for example, an object created using Visual Basic 6.0) that implements IPersistStream. 要反序列化的对象必须在内存中, 方法是先将对象导入 .NET Framework 应用程序。The object to deserialize must be in memory by first importing the object into a .NET Framework application.

当应用程序使用MessageQueue类的实例将消息发送到队列时, 格式化程序将对象序列化为流并将其插入消息正文。When an application sends a message to the queue using an instance of the MessageQueue class, the formatter serializes the object 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.

ActiveX 序列化非常简洁, 这使得使用ActiveXMessageFormatter和 MSMQ COM 控件成为一种非常快速的序列化方法。ActiveX serialization is very compact, which makes using the ActiveXMessageFormatter and MSMQ COM control a very fast method of serialization.

构造函数

ActiveXMessageFormatter()

初始化 ActiveXMessageFormatter 类的新实例。Initializes a new instance of the ActiveXMessageFormatter class.

方法

CanRead(Message)

确定格式化程序是否可以反序列化消息的内容。Determines whether the formatter can deserialize the contents of the message.

Clone()

创建与当前 ActiveXMessageFormatter 相同的 ActiveXMessageFormatter 类的实例。Creates an instance of the ActiveXMessageFormatter class that is identical to the current ActiveXMessageFormatter.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitStreamedObject(Object)

提供帮助序列化 COM 对象的实用工具,这些对象实现 IPersistStream 并要求调用 IPersistStreamInitProvides a utility to help serialize COM objects that implement IPersistStream and require IPersistStreamInit to be called.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Read(Message)

从给定的消息中读取内容,并创建包含反序列化消息的对象。Reads the contents from the given message and creates an object that contains the deserialized message.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
Write(Message, Object)

将对象序列化为消息体。Serializes an object into the body of the message.

适用于