AddressHeader Class
Represents a header that encapsulates an address information item used to identify or interact with an endpoint.
Namespace: System.ServiceModel.Channels
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The AddressHeader type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | CreateAddressHeader(String, String, Object) | Creates a new instance of the AddressHeader class with a specified value, name and namespace. |
![]() ![]() ![]() | CreateAddressHeader(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. |
![]() ![]() | Equals | Determines whether the information item in a specified object is equal to the object contained in the current address header. (Overrides Object.Equals(Object).) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetAddressHeaderReader | Returns an XML reader that can serialize the current address header object. |
![]() ![]() | GetHashCode | Provides a unique hash code for an address header. (Overrides Object.GetHashCode.) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | GetValue(Of T) | Deserializes the information item from the current address header to an object of a specified type. |
![]() ![]() | GetValue(Of T)(XmlObjectSerializer) | Deserializes the information item from the current address header to an object of a specified type that uses a specified formatter to serialize this information. |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | OnWriteAddressHeaderContents | When overridden in a derived class, is invoked when the address header contents are written to a stream or file. |
![]() ![]() | OnWriteStartAddressHeader | When overridden in a derived class, is invoked when the address header contents begin to be written to a stream or file. |
![]() ![]() | ToMessageHeader | Wraps the address header as a message header. |
![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() ![]() | WriteAddressHeader(XmlDictionaryWriter) | Writes the address header to a stream or file using a specified XmlDictionaryWriter. |
![]() ![]() | WriteAddressHeader(XmlWriter) | Writes the address header to a stream or file using a specified XmlWriter. |
![]() ![]() | WriteAddressHeaderContents | Writes the address header contents to a stream or file. |
![]() ![]() | WriteStartAddressHeader | Starts to write the address header contents to a stream or file. |
The following example shows how to create address headers, access their properties, add them to a service endpoint and host the service using the endpoint.
' Name property Dim addressHeaderWithName As AddressHeader = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service",1) Dim addressHeaderName As String = addressHeaderWithName.Name 'Put snippet here. ' Namespace property Dim addressHeaderWithNS As AddressHeader = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service",1) Dim addressHeaderNS As String = addressHeaderWithNS.Namespace ' Create address headers for special services and add them to an array Dim addressHeader1 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1) Dim addressHeader2 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2) Dim addressHeaders() As AddressHeader = { addressHeader1, addressHeader2 } ' Endpoint address constructor with URI and address headers Dim endpointAddressWithHeaders As New EndpointAddress(New Uri("http://localhost/silverlightsamples/service1"), addressHeaders) ' Confirm adddressHeader1 is in endpointAddressWithHeaders - boolHeaders returns True. Dim addressHeaderCollection As AddressHeaderCollection = endpointAddressWithHeaders.Headers Dim boolHeaders As Boolean = addressHeaderCollection.Contains(addressHeader1) 'Create address headers with XmlObjectSerializer specified Dim serializer As XmlObjectSerializer = New DataContractSerializer(GetType(Integer)) Dim addressHeaderWithObjSer As AddressHeader = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service", 1, serializer) Dim value As Integer = addressHeaderWithObjSer.GetValue(Of Integer)()
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.




