Table of Contents

Class ExecContext<T>

Namespace
Tlabs.Misc
Assembly
Tlabs.Core.dll

Execution context to contain a thread-local reference value of T

public static class ExecContext<T> where T : class

Type Parameters

T
Inheritance
ExecContext<T>
Inherited Members

Remarks

This allows to setup some simple context data that will be accessible within the call stack of an Action>.

Properties

CurrentData

Returns the current context-data of a previously started context.

public static T CurrentData { get; }

Property Value

T

Exceptions

InvalidOperationException

if no context was previously started

HasData

true if has constext data from started context.

public static bool HasData { get; }

Property Value

bool

Methods

StartWith(T, Action)

Start a new context with ctxData accessible within the call stack of the ctxAction.

public static void StartWith(T ctxData, Action ctxAction)

Parameters

ctxData T
ctxAction Action

Exceptions

InvalidOperationException

if context of T was already started.