PostSharpAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​ContextsILogging­ContextFor­Each­Property
Open sandboxFocus

ILoggingContext.ForEachProperty Method

ForEachProperty(LoggingPropertyVisitor<Object>, Boolean)

Invokes a delegate for each property defined in the current logging context and optionally in its ancestor contexts.

Declaration
void ForEachProperty(LoggingPropertyVisitor<object> visitor, bool includeAncestors = true)
Parameters
Type Name Description
LoggingPropertyVisitor<Object> visitor

The delegate to invoke. The state parameter of the delegate will be assigned to a dummy variable.

Boolean includeAncestors

true if ancestor contexts should be visited, false if only the current context should be visited.

Remarks

This method will visit all properties regardless of their name. If several properties have the same name, they will be visited several times.

ForEachProperty<T>(LoggingPropertyVisitor<T>, ref T, Boolean)

Invokes a delegate for each property defined in the current logging context and optionally in its ancestor contexts, and specifies passes a state object to the delegate.

Declaration
void ForEachProperty<T>(LoggingPropertyVisitor<T> visitor, ref T state, bool includeAncestors = true)
Parameters
Type Name Description
LoggingPropertyVisitor<T> visitor

The delegate to invoke. The state parameter of the delegate will be assigned to a dummy variable.

T state

Some state that will be passed to the visitor delegate.

Boolean includeAncestors

true if ancestor contexts should be visited, false if only the current context should be visited.

Type Parameters
Name Description
T

Type of the state passed to the visitor delegate.

Remarks

This method will visit all properties regardless of their name. If several properties have the same name, they will be visited several times.