XmlMessageFormatter.CanRead(Message) XmlMessageFormatter.CanRead(Message) XmlMessageFormatter.CanRead(Message) Method

Definition

Determines whether the formatter can deserialize the message.

public:
 virtual bool CanRead(System::Messaging::Message ^ message);
public bool CanRead (System.Messaging.Message message);
abstract member CanRead : System.Messaging.Message -> bool
override this.CanRead : System.Messaging.Message -> bool

Parameters

message
Message Message Message

The Message to inspect.

Returns

true if the XML formatter can deserialize the message; otherwise, false.

Implements

Exceptions

Remarks

When CanRead is called, the formatter attempts to determine if the contents of the message are something it can deserialize. The formatter can only deserialize the message if the type in the message body has the same schema as one of the types in the array represented by the TargetTypeNames and TargetTypes properties. CanRead returns false under the following two circumstances:

The TargetTypeNames and TargetTypes properties tell the formatter what types of objects it must be able to deserialize. If any type is missing from the list, yet is found within the message, CanRead returns false.

Applies to

See also