Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetHeader(T) Method (Int32)

MessageHeaders.GetHeader<T> Method (Int32)

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

Namespace:  System.ServiceModel.Channels
Assemblies:   System.ServiceModel (in System.ServiceModel.dll)
  System.ServiceModel.Primitives (in System.ServiceModel.Primitives.dll)

public T GetHeader<T>(
	int index
)

Type Parameters

T

The type of the message header.

Parameters

index
Type: System.Int32

The zero-based index of the header to get.

Return Value

Type: T
A message header at the specified index.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft