MessageProperties 類別

定義

表示訊息屬性集。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))
繼承
MessageProperties
實作

備註

在訊息通過通道基礎結構的同時,它也會通過許多邏輯上獨立的處理實體。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:

@no__t 0The 伺服器已認可通訊協定違規。Section = ResponseBody Detail = 回應區塊格式無效 @ no__t-0The server committed a protocol violation. Section=ResponseBody Detail=Response chunk format is invalid

建構函式

MessageProperties()

初始化 MessageProperties 類別的新執行個體。Initializes a new instance of the MessageProperties class.

MessageProperties(MessageProperties)

使用預設屬性來初始化 MessageProperties 類別的新執行個體。Initializes a new instance of the MessageProperties class with preset properties.

屬性

AllowOutputBatching

取得或設定值,這個值會指定是否要在將此訊息交付傳輸之前先儲存。Gets or sets a value that specifies whether to store this message before giving it to the transport.

Count

取得 MessageProperties 中的屬性總數。Gets the total number of properties in the MessageProperties.

Encoder

取得編碼器,這個編碼器可用來寫入訊息至資料流及讀取資料流中的訊息。Gets the encoder that is used to write messages to a stream and to read messages from a stream.

IsFixedSize

取得值,指出 MessageProperties 是否有固定的大小。Gets a value that indicates whether the MessageProperties has a fixed size.

IsReadOnly

取得值,這個值表示這個屬性集是否是唯讀的。Gets a value that indicates whether this set of properties is read-only.

Item[String]

擷取具有指定名稱、識別碼或索引鍵值的屬性。Retrieves a property with the specified name, identifier, or key value.

Keys

取得 ICollection 中包含索引鍵的 MessagePropertiesGets an ICollection that contains the keys in the MessageProperties.

Security

取得或設定訊息的安全性相關屬性。Gets or sets the security-related property of a message.

Values

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

Via

取得或設定傳送訊息時使用的傳輸位址。Gets or sets the transport address that is used to send messages.

方法

Add(String, Object)

將具有指定名稱和屬性的項目加入至 MessageProperties 集合。Adds an element with the specified name and property into the MessageProperties collection.

Clear()

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

ContainsKey(String)

判斷 MessageProperties 是否包含特定名稱、索引鍵或識別項。Determines whether the MessageProperties contains a specific name, key, or identifier.

CopyProperties(MessageProperties)

將指定之 MessageProperties 的內容複製到這個執行個體。Copies the content of the specified MessageProperties to this instance.

Dispose()

釋放 MessageProperties 類別所使用的所有資源。Releases all resources used by the MessageProperties class.

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)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(String)

MessageProperties 中移除具有指定之名稱的項目。Removes the element with the specified name from the MessageProperties.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 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>)

將有指定名稱和屬性的項目加入 MessagePropertiesAdds an element with the specified name and property into the MessageProperties.

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)

從指定索引處開始,複製指定之 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>>.Remove(KeyValuePair<String,Object>)

MessageProperties 中移除具有指定之名稱的項目。Removes the element with the specified name from the MessageProperties.

IEnumerable.GetEnumerator()

傳回可逐一查看集合的列舉值。Returns an enumerator that can iterate through a collection.

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

傳回可逐一查看集合的列舉值。Returns an enumerator that can iterate through a collection.

擴充方法

CopyToDataTable<T>(IEnumerable<T>)

根據輸入 DataTable 物件 (其中泛型參數 TDataRow) 傳回包含 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 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)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

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)

傳回包含來源集合中每個節點祖系的已篩選項目集合。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>)

傳回來源集合中每個文件和項目之子代節點的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

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)

傳回已篩選的項目集合,其中包含來源集合中每個項目和文件的子代項目。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>)

傳回來源集合中每個項目和文件的子項目集合。Returns a collection of the child elements of every element and document in the source collection.

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>)

傳回包含來源集合中所有節點的節點集合,依據文件順序來排序。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>)

傳回來源集合中每個文件和項目的子節點集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>)

在來源集合中,從每一個節點的父節點移除這些節點。Removes every node in the source collection from its parent node.

適用於