PostSharpAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​ContextsLogging­ContextVisit­Properties
Open sandboxFocus

LoggingContext.VisitProperties Method

VisitProperties<TState>(ILoggingPropertyVisitor<TState>, ref TState, in LoggingPropertyVisitorOptions)

Invokes the Visit<TValue>(String, TValue, in LoggingPropertyOptions, ref TState) method of an interface implementation for each property on the current context, and, optionally, for inherited properties in ancestor contexts.

Declaration
public void VisitProperties<TState>([Required] ILoggingPropertyVisitor<TState> visitor, ref TState state, in LoggingPropertyVisitorOptions options = null)
Parameters
Type Name Description
ILoggingPropertyVisitor<TState> visitor

The visitor implementation.

TState state

The opaque state passed through to the visitor.

LoggingPropertyVisitorOptions options

Visitor options.

Type Parameters
Name Description
TState

The type of the opaque state passed through to the visitor.

VisitProperties(Action<String, Object>, Boolean)

Invokes a delegate each property on the current context, and, optionally, for inherited properties in ancestor contexts. This offers a simple way to visit properties, but it has a performance overhead compared to VisitProperties<TState>(ILoggingPropertyVisitor<TState>, ref TState, in LoggingPropertyVisitorOptions) because it is weakly typed and cause the allocation of a closure class to build the action. It also does not expose the LoggingPropertyOptions.

Declaration
public void VisitProperties([Required] Action<string, object> action, bool includeAncestors = true)
Parameters
Type Name Description
System.Action<System.String, Object> action

The delegate to call for each property. The first value is the property name, the second its value.

Boolean includeAncestors

Whether inherited properties of ancestor contexts should be visited too.