XPathMessageFilterTable<TFilterData>.TryGetValue Method (MessageFilter, TFilterData)

 

Checks whether a filter is stored in the filter table.

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

public bool TryGetValue(
	MessageFilter filter,
	out TFilterData data
)

Parameters

filter
Type: System.ServiceModel.Dispatcher.MessageFilter

A key to retrieve the data.

data
Type: TFilterData

The data associated with the filter when this method returns true; otherwise, the default value for the type of the data parameter.

Return Value

Type: System.Boolean

true if the filter is present in the filter table; false otherwise.

This method is an efficient way to check whether a filter is in the filter table because when the filter is not present it returns false instead of throwing an exception. If you try to retrieve the filter from the table using its Item property (the indexer in C#) and it is not there, an exception is thrown.

.NET Framework
Available since 3.0
Return to top
Show: