Table of Contents

Class EmptyHeaders

Namespace
MassTransit.Serialization
Assembly
MassTransit.Abstractions.dll
public class EmptyHeaders : Headers, IEnumerable<HeaderValue>, IEnumerable
Inheritance
EmptyHeaders
Implements
Inherited Members
Extension Methods

Fields

Instance

public static readonly EmptyHeaders Instance

Field Value

EmptyHeaders

Methods

GetAll()

Returns all available headers

public IEnumerable<KeyValuePair<string, object>> GetAll()

Returns

IEnumerable<KeyValuePair<string, object>>

GetEnumerator()

public IEnumerator<HeaderValue> GetEnumerator()

Returns

IEnumerator<HeaderValue>

Get<T>(string, T?)

Returns the specified header as the type, returning a default value is the header is not found

public T? Get<T>(string key, T? defaultValue = null) where T : struct

Parameters

key string

The header name

defaultValue T?

The default value of the header if not found

Returns

T?

The header value

Type Parameters

T

The result type

Get<T>(string, T?)

Returns the specified header as the type, returning a default value is the header is not found

public T? Get<T>(string key, T? defaultValue) where T : class

Parameters

key string

The header name

defaultValue T

The default value of the header if not found

Returns

T

The header value

Type Parameters

T

The result type

TryGetHeader(string, out object?)

If the specified header name is found, returns the value of the header as an object

public bool TryGetHeader(string key, out object? value)

Parameters

key string

The header name

value object

The output header value

Returns

bool

True if the header is present, otherwise false