MessageProperties MessageProperties MessageProperties MessageProperties Class

定义

表示消息的一组属性。Represents a set of properties for a message. 此类不能被继承。This class cannot be inherited.

public ref class MessageProperties sealed : IDisposable, System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^>>, System::Collections::Generic::IDictionary<System::String ^, System::Object ^>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^>>
public sealed class MessageProperties : IDisposable, System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>, System.Collections.Generic.IDictionary<string,object>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object>>
type MessageProperties = class
    interface IDictionary<string, obj>
    interface ICollection<KeyValuePair<string, obj>>
    interface seq<KeyValuePair<string, obj>>
    interface IEnumerable
    interface IDisposable
Public NotInheritable Class MessageProperties
Implements ICollection(Of KeyValuePair(Of String, Object)), IDictionary(Of String, Object), IDisposable, IEnumerable(Of KeyValuePair(Of String, Object))
继承
MessagePropertiesMessagePropertiesMessagePropertiesMessageProperties
实现

注解

消息在通道基础结构中传递时,会经过多个在逻辑上独立的处理实体。As a message passes through the channel infrastructure, it passes through a number of logically separate processing entities. 例如,可靠消息流中的某条消息可能会经过 MessageEncoder、传输级别通道提供程序、可靠消息通道提供程序、流通道提供程序或任何通道扩展。For instance, a message that is part of a reliable messaging stream can potentially pass through a MessageEncoder, a transport-level channel provider, the reliable-messaging channel provider, the streaming channel provider or any channel extensions. 有时,这些中介会利用 MessageProperties 类,以处理结果对消息进行批注。Sometimes these intermediaries annotate the message with the results of that processing by using the MessageProperties class. MessageProperties 实例是消息的批注,以一组名称到对象的映射形式存储在 Properties 实例的 Message 属性中。A MessageProperties instance is an annotation on a message and is stored as a set of name-to-object mappings in the Properties property of a Message instance.

备注

当用户收到以下错误时,应清除消息属性:The message properties should be cleared out when the user gets the following error:

服务器提交了协议冲突。Section = ResponseBody Detail = Response 组块格式无效The server committed a protocol violation. Section=ResponseBody Detail=Response chunk format is invalid

构造函数

MessageProperties() MessageProperties() MessageProperties() MessageProperties()

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

MessageProperties(MessageProperties) MessageProperties(MessageProperties) MessageProperties(MessageProperties) MessageProperties(MessageProperties)

使用预设属性,初始化 MessageProperties 类的新实例。Initializes a new instance of the MessageProperties class with preset properties.

属性

AllowOutputBatching AllowOutputBatching AllowOutputBatching AllowOutputBatching

获取或设置一个值,该值指定是否在传输消息之前对其进行存储。Gets or sets a value that specifies whether to store this message before giving it to the transport.

Count Count Count Count

获取 MessageProperties 中的属性总数。Gets the total number of properties in the MessageProperties.

Encoder Encoder Encoder Encoder

获取用于将消息写入流中并从流中读取消息的编码器。Gets the encoder that is used to write messages to a stream and to read messages from a stream.

IsFixedSize IsFixedSize IsFixedSize IsFixedSize

获取一个值,该值指示 MessageProperties 是否具有固定大小。Gets a value that indicates whether the MessageProperties has a fixed size.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示此组属性是否为只读。Gets a value that indicates whether this set of properties is read-only.

Item[String] Item[String] Item[String] Item[String]

检索具有指定名称、标识符或键值的属性。Retrieves a property with the specified name, identifier, or key value.

Keys Keys Keys Keys

获取包含 ICollection 中的键的 MessagePropertiesGets an ICollection that contains the keys in the MessageProperties.

Security Security Security Security

获取或设置消息的安全相关属性。Gets or sets the security-related property of a message.

Values Values Values Values

获取包含 ICollection 中的值的 MessagePropertiesGets an ICollection that contains the values in the MessageProperties.

Via Via Via Via

获取或设置用于发送消息的传输地址。Gets or sets the transport address that is used to send messages.

方法

Add(String, Object) Add(String, Object) Add(String, Object) Add(String, Object)

将具有指定名称和属性的元素添加到 MessageProperties 集合中。Adds an element with the specified name and property into the MessageProperties collection.

Clear() Clear() Clear() Clear()

移除 MessageProperties 集合中的所有元素。Removes all elements from the MessageProperties collection.

ContainsKey(String) ContainsKey(String) ContainsKey(String) ContainsKey(String)

确定 MessageProperties 是否包含一个特定的名称、键或标识符。Determines whether the MessageProperties contains a specific name, key, or identifier.

CopyProperties(MessageProperties) CopyProperties(MessageProperties) CopyProperties(MessageProperties) CopyProperties(MessageProperties)

将指定的 MessageProperties 的内容复制到此实例。Copies the content of the specified MessageProperties to this instance.

Dispose() Dispose() Dispose() Dispose()

释放 MessageProperties 类使用的所有资源。Releases all resources used by the MessageProperties class.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
Remove(String) Remove(String) Remove(String) Remove(String)

MessageProperties 中移除具有指定名称的元素。Removes the element with the specified name from the MessageProperties.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
TryGetValue(String, Object) TryGetValue(String, Object) TryGetValue(String, Object) TryGetValue(String, Object)

确定 MessageProperties 是否包含特定名称,并检索其值。Determines whether the MessageProperties contains a specific name, and retrieves its value.

显式界面实现

ICollection<KeyValuePair<String,Object>>.Add(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Add(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Add(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Add(KeyValuePair<String,Object>)

将具有指定名称和属性的元素添加到 MessageProperties 中。Adds an element with the specified name and property into the MessageProperties.

ICollection<KeyValuePair<String,Object>>.Contains(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Contains(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Contains(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Contains(KeyValuePair<String,Object>)

确定 MessageProperties 是否包含特定名称。Determines whether the MessageProperties contains a specific name.

ICollection<KeyValuePair<String,Object>>.CopyTo(KeyValuePair<String,Object>[], Int32) ICollection<KeyValuePair<String,Object>>.CopyTo(KeyValuePair<String,Object>[], Int32) ICollection<KeyValuePair<String,Object>>.CopyTo(KeyValuePair<String,Object>[], Int32) ICollection<KeyValuePair<String,Object>>.CopyTo(KeyValuePair<String,Object>[], Int32)

从指定的索引开始,将指定的 MessageProperties 的内容复制到一个数组中。Copies the content of the specified MessageProperties to an array, starting at the specified index.

ICollection<KeyValuePair<String,Object>>.IsReadOnly ICollection<KeyValuePair<String,Object>>.IsReadOnly ICollection<KeyValuePair<String,Object>>.IsReadOnly ICollection<KeyValuePair<String,Object>>.IsReadOnly
ICollection<KeyValuePair<String,Object>>.Remove(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Remove(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Remove(KeyValuePair<String,Object>) ICollection<KeyValuePair<String,Object>>.Remove(KeyValuePair<String,Object>)

MessageProperties 中移除具有指定名称的元素。Removes the element with the specified name from the MessageProperties.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回可循环访问集合的枚举数。Returns an enumerator that can iterate through a collection.

IEnumerable<KeyValuePair<String,Object>>.GetEnumerator() IEnumerable<KeyValuePair<String,Object>>.GetEnumerator() IEnumerable<KeyValuePair<String,Object>>.GetEnumerator() IEnumerable<KeyValuePair<String,Object>>.GetEnumerator()

返回可循环访问集合的枚举数。Returns an enumerator that can iterate through a collection.

扩展方法

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个节点的上级。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

返回源集合中经过筛选的每个元素和文档的子元素集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

返回节点集合(其中包含源集合中的所有节点),并按文档顺序排列。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

将源集合中的每个节点从其父节点中移除。Removes every node in the source collection from its parent node.

适用于