BinaryMessageFormatter.Write(Message, Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將物件序列化到訊息正文中。
public:
virtual void Write(System::Messaging::Message ^ message, System::Object ^ obj);
public void Write(System.Messaging.Message message, object obj);
abstract member Write : System.Messaging.Message * obj -> unit
override this.Write : System.Messaging.Message * obj -> unit
Public Sub Write (message As Message, obj As Object)
參數
- obj
- Object
要序列化到訊息主體的物件。
實作
例外狀況
參數 message 為 null。
備註
Important
使用不受信任的資料呼叫此方法存在安全風險。 只有在受信任的資料時才會呼叫此方法。 如需詳細資訊,請參閱 驗證所有輸入。
寫入隊列時不需要指定頂端物件格式與類型格式,因為讀取時必須如此。 TopObjectFormat格式TypeFormat化器僅在反序列化訊息時使用與屬性。
它可以 BinaryMessageFormatter 序列化大多數物件,但結果並非鬆散耦合。 不過,它很緊湊,因此格式化器對大型物件來說是有效率的。