AddressHeaderCollection.FindHeader Method

Finds the first address header in the collection with a specified name and namespace.

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

public AddressHeader FindHeader(
	string name,
	string ns


Type: System.String

The name of the address header to be found.

Type: System.String

The namespace of the address header to be found.

Return Value

Type: System.ServiceModel.Channels.AddressHeader
The AddressHeader in the collection with the specified name and namespace.


name or ns is null.


There is more than one header that has the specified name and ns.

If you need to find all the address headers in the collection with the specified name and namespace, use the FindAll(String, String) method instead.

ArgumentException is not the ideal exception type when there is more than one header in the collection. Callers of this method should take care to handle this exception when the collection contains multiple entries with the same name and namespace.

The following code snippet illustrates how to call this method.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

.NET Compact Framework

Supported in: 3.5
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft