XmlMessageFormatter.CanRead(Message) Método
Definição
Determina se o formatador pode desserializar a mensagem.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
Public Function CanRead (message As Message) As Boolean
Parâmetros
Retornos
true se o formatador XML puder desserializar a mensagem; caso contrário, false.true if the XML formatter can deserialize the message; otherwise, false.
Implementações
Exceções
Nenhuma das propriedades TargetTypeNames ou TargetTypes foi definida.Neither the TargetTypeNames nor TargetTypes property has been set.
O parâmetro message é null.The message parameter is null.
Comentários
Quando CanRead é chamado, o formatador tenta determinar se o conteúdo da mensagem é algo que ele pode desserializar.When CanRead is called, the formatter attempts to determine if the contents of the message are something it can deserialize. O formatador só poderá desserializar a mensagem se o tipo no corpo da mensagem tiver o mesmo esquema que um dos tipos na matriz representado pelas TargetTypeNames TargetTypes Propriedades e.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 retorna false sob as duas circunstâncias a seguir:CanRead returns false under the following two circumstances:
A mensagem não foi formatada usando o XmlMessageFormatter .The message was not formatted using the XmlMessageFormatter.
O esquema do corpo da mensagem não está entre os listados na TargetTypeNames TargetTypes propriedade ou.The schema of the message body is not among those listed in either the TargetTypeNames or TargetTypes property.
As TargetTypeNames TargetTypes Propriedades e informam ao formatador quais tipos de objetos ele deve ser capaz de desserializar.The TargetTypeNames and TargetTypes properties tell the formatter what types of objects it must be able to deserialize. Se algum tipo estiver faltando na lista, mas for encontrado na mensagem, CanRead retornará false .If any type is missing from the list, yet is found within the message, CanRead returns false.