<PackageReference Include="NLog" Version="6.2.0" />

NLog.MappedDiagnosticsLogicalContext

public static class MappedDiagnosticsLogicalContext
Obsolete and replaced by ScopeContext with NLog v5. Mapped Diagnostics Logical Context (MDLC) is a dictionary of keys and values. Stores the dictionary in the logical thread callcontext, and provides methods to output dictionary values in layouts. Allows for maintaining state across asynchronous tasks and call contexts.
public static void Clear()

Clears the content of current logical context.

public static void Clear(bool free)

Clears the content of current logical context.

public static bool Contains(string item)

Checks whether the specified item exists in current logical context.

public static string Get(string item)

Gets the current logical context named item, as String.

public static string Get(string item, IFormatProvider formatProvider)

Gets the current logical context named item, as String.

public static ICollection<string> GetNames()

Returns all item names

public static object GetObject(string item)

Gets the current logical context named item, as Object.

public static void Remove(string item)

Removes the specified item from current logical context.

public static void Set(string item, string value)

Sets the current logical context item to the specified value.

public static void Set(string item, object value)

Sets the current logical context item to the specified value.

public static void Set<T>(string item, T value)

Sets the current logical context item to the specified value.

public static IDisposable SetScoped(string item, string value)

Sets the current logical context item to the specified value.

public static IDisposable SetScoped(string item, object value)

Sets the current logical context item to the specified value.

public static IDisposable SetScoped<T>(string item, T value)

Sets the current logical context item to the specified value.

public static IDisposable SetScoped(IReadOnlyList<KeyValuePair<string, object>> items)

Updates the current logical context with multiple items in single operation