Edit

Share via


BinaryMessageFormatter.CanRead(Message) Method

Definition

Determines whether the formatter can deserialize the contents of the message.

public bool CanRead(System.Messaging.Message message);

Parameters

message
Message

The Message to inspect.

Returns

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

Implements

Exceptions

The message parameter is null.

Remarks

Important

Calling methods from this class with untrusted data is a security risk. Call the methods from this class only with trusted data. For more information, see Validate All Inputs.

CanRead returns false if the message body is not a binary object.

On the receiving computer, CanRead returns true if the assembly for the class to be deserialized exists locally. The assembly must be found in the global assembly cache, or be linked to the application (for example, if the object represents a custom class).

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1