This documentation is archived and is not being maintained.

MessageFilter.Match Method

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

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method Match(Message) When overridden in a derived class, tests whether a message satisfies the filter criteria. The body cannot be examined.
Public method Match(MessageBuffer) When overridden in a derived class, tests whether a buffered message satisfies the criteria of a filter.
Top

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.

Show: