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

NLog.NestedDiagnosticsContext

public static class NestedDiagnosticsContext
Obsolete and replaced by ScopeContext with NLog v5. Nested Diagnostics Context (NDC) is a stack of nested values. Stores the stack in the thread-local static variable, and provides methods to output the values in layouts.
public static string TopMessage { get; }

Gets the top NDC message but doesn't remove it.

public static object TopObject { get; }

Gets the top NDC object but doesn't remove it.

public static void Clear()

Clears current thread NDC stack.

public static string[] GetAllMessages()

Gets all messages on the stack.

public static string[] GetAllMessages(IFormatProvider formatProvider)

Gets all messages from the stack, without removing them.

public static object[] GetAllObjects()

Gets all objects on the stack.

public static object PeekObject()

Peeks the first object on the NDC stack

public static string Pop()

Pops the top message off the NDC stack.

public static string Pop(IFormatProvider formatProvider)

Pops the top message from the NDC stack.

public static object PopObject()

Pops the top object off the NDC stack.

public static IDisposable Push(string text)

Pushes the specified text on current thread NDC.

public static IDisposable Push(object value)

Pushes the specified object on current thread NDC.