CreateAddressHeader Method (String, String, Object, XmlObjectSerializer)

AddressHeader.CreateAddressHeader Method (String, String, Object, XmlObjectSerializer)

Creates a new instance of the AddressHeader class with a specified name and namespace that uses a specified formatter to serialize the information item from a specified object.

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

public static AddressHeader CreateAddressHeader (
	string name,
	string ns,
	Object value,
	XmlObjectSerializer serializer
public static AddressHeader CreateAddressHeader (
	String name, 
	String ns, 
	Object value, 
	XmlObjectSerializer serializer
public static function CreateAddressHeader (
	name : String, 
	ns : String, 
	value : Object, 
	serializer : XmlObjectSerializer
) : AddressHeader
Not applicable.



The name of the address header.


The namespace of the address header.


The Object that provides the information item for the address header.


The XmlObjectSerializer used to serialize the specified object in the value parameter.

Return Value

The AddressHeader with the specified name and ns that contains the information item specified by value.

Exception typeCondition


name or serializer is a null reference (Nothing in Visual Basic) or name.Length == 0.

The following sample shows how to create an address header using this constructor:

AddressHeader ah4 = AddressHeader.CreateAddressHeader("MyHeader", "http://MyService", "Some data", serializer);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2016 Microsoft