Table of Contents

Class MessageHeadersExtensions

Namespace
AnyProtocol.Abstraction
Assembly
AnyProtocol.Abstraction.dll

Provides typed accessors for standard AnyProtocol message headers.

public static class MessageHeadersExtensions
Inheritance
MessageHeadersExtensions
Inherited Members

Methods

Get<T>(IMessageHeaders, string, T)

Gets <t>.

public static T Get<T>(this IMessageHeaders headers, string key, T defaultValue = default)

Parameters

headers IMessageHeaders

The headers.

key string

The key that identifies the value.

defaultValue T

The default value.

Returns

T

The result of the get<t> operation.

Type Parameters

T

The header value type.

Set<T>(IMessageHeaders, string, T)

Performs the set<t> operation.

public static void Set<T>(this IMessageHeaders headers, string key, T value) where T : notnull

Parameters

headers IMessageHeaders

The headers.

key string

The key that identifies the value.

value T

The value to store.

Type Parameters

T

The header value type.

TryGet<T>(IMessageHeaders, string, out T?)

Attempts to get<t>.

public static bool TryGet<T>(this IMessageHeaders headers, string key, out T? value)

Parameters

headers IMessageHeaders

The headers.

key string

The key that identifies the value.

value T

The value to store.

Returns

bool

true when the operation succeeds; otherwise, false.

Type Parameters

T

The header value type.