PostSharpAPI ReferencePost­Sharp.​Patterns.​ModelIAggregatableVisit­Children
Open sandboxFocus

IAggregatable.VisitChildren Method

VisitChildren(ChildVisitor, ChildVisitorOptions, Object)

Executes an action for all direct children of the current object.

Declaration
bool VisitChildren(ChildVisitor visitor, ChildVisitorOptions options, object state = null)
Parameters
Type Name Description
ChildVisitor visitor

The action to be executed for each child.

ChildVisitorOptions options

Options. The default behavior is to enumerate all children, but ignore parent surrogates.

Object state
Returns
Type Description
Boolean

false if visitor returned Stop, otherwise true.

Remarks
note

If a parent is bound to a child through several relationships (for instance several fields), the visitor delegate will be invoked several times, once for each relationship. Store visited children into a System.Collections.Generic.HashSet<> if you need to perform an action only once per child.