MessageFilter.Match Method

 

When overridden in a derived class, tests whether a message or a buffered message satisfies the criteria of a filter.

Namespace:   System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

NameDescription
System_CAPS_pubmethodMatch(Message)

When overridden in a derived class, tests whether a message satisfies the filter criteria. The body cannot be examined.

System_CAPS_pubmethodMatch(MessageBuffer)

When overridden in a derived class, tests whether a buffered message satisfies the criteria of a filter.

The difference between the two overloads is that one takes a Message parameter and is not permitted to examine the body. The other takes a MessageBuffer parameter and can examine any part of the message. Message headers are automatically buffered and can be inspected by a filter without being consumed. But if the body is to be inspected by a filter, then the entire message must be buffered because an unbuffered message body can be consumed by a query and its contents destroyed.

Use Match if examination of the body is not required. Use Match if examination of the message body is required.

Notes to Implementers:

Null messages are invalid, and should cause an ArgumentNullException to be thrown.

Return to top
Show: