BinaryMessageFormatter.Write(Message, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Serializes an object into the body of the message.
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)
Parameters
- obj
- Object
The object to be serialized into the message body.
Implements
Exceptions
The message
parameter is null
.
Remarks
Important
Calling this method with untrusted data is a security risk. Call this method only with trusted data. For more information, see Validate All Inputs.
The top object format and type format need not be specified to write to the queue as they must be when reading. The TopObjectFormat and TypeFormat properties are used by the formatter only when deserializing a message.
The BinaryMessageFormatter can serialize most objects, but the result is not loosely coupled. However, it is compact, so the formatter is efficient for large objects.