編輯

共用方式為


MessageHeaders.GetHeader Method

Definition

Retrieves a message header in this collection.

Overloads

GetHeader<T>(String, String, XmlObjectSerializer)

Retrieves a message header in this collection by the specified LocalName, namespace URI and serializer.

GetHeader<T>(String, String)

Finds a message header in this collection by the specified LocalName and namespace URI of the header element.

GetHeader<T>(String, String, String[])

Retrieves a message header in this collection by the specified LocalName, namespace URI and actors of the header element.

GetHeader<T>(Int32)

Retrieves a message header at a specific position in this collection.

GetHeader<T>(Int32, XmlObjectSerializer)

Retrieves a message header at a specific position in this collection.

GetHeader<T>(String, String, XmlObjectSerializer)

Source:
MessageHeaders.cs
Source:
MessageHeaders.cs

Retrieves a message header in this collection by the specified LocalName, namespace URI and serializer.

public:
generic <typename T>
 T GetHeader(System::String ^ name, System::String ^ ns, System::Runtime::Serialization::XmlObjectSerializer ^ serializer);
public T GetHeader<T> (string name, string ns, System.Runtime.Serialization.XmlObjectSerializer serializer);
member this.GetHeader : string * string * System.Runtime.Serialization.XmlObjectSerializer -> 'T
Public Function GetHeader(Of T) (name As String, ns As String, serializer As XmlObjectSerializer) As T

Type Parameters

T

The type of the message header.

Parameters

name
String

The LocalName of the header XML element.

ns
String

The namespace URI of the header XML element.

serializer
XmlObjectSerializer

An XmlObjectSerializer that is used to serialize the header.

Returns

T

A message header with the specified name.

Applies to

GetHeader<T>(String, String)

Source:
MessageHeaders.cs
Source:
MessageHeaders.cs

Finds a message header in this collection by the specified LocalName and namespace URI of the header element.

public:
generic <typename T>
 T GetHeader(System::String ^ name, System::String ^ ns);
public T GetHeader<T> (string name, string ns);
member this.GetHeader : string * string -> 'T
Public Function GetHeader(Of T) (name As String, ns As String) As T

Type Parameters

T

The type of the message header.

Parameters

name
String

The LocalName of the header XML element.

ns
String

The namespace URI of the header XML element.

Returns

T

A message header with the specified name.

Remarks

This method only uses the DataContractSerializer. It does not try to detect from the type whether it should use the XmlObjectSerializer or the DataContractSerializer. To use the XML serializer, call GetHeader<T>(String, String, XmlObjectSerializer) or obtain the reader at the contents and call directly into the serializer.

Applies to

GetHeader<T>(String, String, String[])

Source:
MessageHeaders.cs
Source:
MessageHeaders.cs

Retrieves a message header in this collection by the specified LocalName, namespace URI and actors of the header element.

public:
generic <typename T>
 T GetHeader(System::String ^ name, System::String ^ ns, ... cli::array <System::String ^> ^ actors);
public T GetHeader<T> (string name, string ns, params string[] actors);
member this.GetHeader : string * string * string[] -> 'T
Public Function GetHeader(Of T) (name As String, ns As String, ParamArray actors As String()) As T

Type Parameters

T

The type of the message header.

Parameters

name
String

The LocalName of the header XML element.

ns
String

The namespace URI of the header XML element.

actors
String[]

The targeted recipient of the message header.

Returns

T

A message header with the specified name.

Remarks

This method only uses the DataContractSerializer. It does not try to detect from the type whether it should use the XmlObjectSerializer or DataContractSerializer. To use the XML serializer, call GetHeader<T>(String, String, XmlObjectSerializer) or obtain the reader at the contents and call directly into the serializer.

Applies to

GetHeader<T>(Int32)

Source:
MessageHeaders.cs
Source:
MessageHeaders.cs

Retrieves a message header at a specific position in this collection.

public:
generic <typename T>
 T GetHeader(int index);
public T GetHeader<T> (int index);
member this.GetHeader : int -> 'T
Public Function GetHeader(Of T) (index As Integer) As T

Type Parameters

T

The type of the message header.

Parameters

index
Int32

The zero-based index of the header to get.

Returns

T

A message header at the specified index.

Remarks

This method only uses the DataContractSerializer. It does not try to detect from the type whether it should use the XmlObjectSerializer or DataContractSerializer. To use the XML serializer, call GetHeader<T>(String, String, XmlObjectSerializer) or obtain the reader at the contents and call directly into the serializer.

Applies to

GetHeader<T>(Int32, XmlObjectSerializer)

Source:
MessageHeaders.cs
Source:
MessageHeaders.cs

Retrieves a message header at a specific position in this collection.

public:
generic <typename T>
 T GetHeader(int index, System::Runtime::Serialization::XmlObjectSerializer ^ serializer);
public T GetHeader<T> (int index, System.Runtime.Serialization.XmlObjectSerializer serializer);
member this.GetHeader : int * System.Runtime.Serialization.XmlObjectSerializer -> 'T
Public Function GetHeader(Of T) (index As Integer, serializer As XmlObjectSerializer) As T

Type Parameters

T

The type of the message header.

Parameters

index
Int32

The zero-based index of the header to get.

serializer
XmlObjectSerializer

An XmlObjectSerializer that is used to serialize the header.

Returns

T

A message header at the specified index.

Applies to