XmlMessageFormatter.Read(Message) 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.
Reads the contents from the given message and creates an object that contains the deserialized message.
public:
virtual System::Object ^ Read(System::Messaging::Message ^ message);
public object Read (System.Messaging.Message message);
abstract member Read : System.Messaging.Message -> obj
override this.Read : System.Messaging.Message -> obj
Public Function Read (message As Message) As Object
Parameters
Returns
The deserialized message.
Implements
Exceptions
Neither the TargetTypeNames nor TargetTypes property has been set.
-or-
The instance serialized in the message body does not comply with any of the schemas represented by the types in the TargetTypeNames and TargetTypes properties.
The message
parameter is null
.
Remarks
Both the TargetTypeNames and TargetTypes properties tell the formatter what schemas to attempt to match when deserializing a message. One of these properties must be set before the message can be deserialized.
The instance serialized in the message body must comply with one of the schemas represented in the type array. When you read the message using the Receive method, the method creates an object of the type that corresponds to the schema identified and reads the message body into it.
The target types do not have to be specified in order to write to the queue.