Table of Contents

Class ThreadLocalRuntimeContextSlot<T>

Namespace
OpenTelemetry.Context
Assembly
OpenTelemetry.Api.dll

The thread local (TLS) implementation of context slot.

public class ThreadLocalRuntimeContextSlot<T> : RuntimeContextSlot<T>, IDisposable, IRuntimeContextSlotValueAccessor

Type Parameters

T

The type of the underlying value.

Inheritance
ThreadLocalRuntimeContextSlot<T>
Implements
Inherited Members

Constructors

ThreadLocalRuntimeContextSlot(string)

Initializes a new instance of the ThreadLocalRuntimeContextSlot<T> class.

public ThreadLocalRuntimeContextSlot(string name)

Parameters

name string

The name of the context slot.

Properties

Value

Gets or sets the value of the slot as an object.

public object Value { get; set; }

Property Value

object

Methods

Dispose(bool)

Releases the unmanaged resources used by this class and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Get()

Get the value from the context slot.

public override T Get()

Returns

T

The value retrieved from the context slot.

Set(T)

Set the value to the context slot.

public override void Set(T value)

Parameters

value T

The value to be set.