Click or drag to resize

RuleElementExtensionsMatch Method (RuleElement, ActionPatternElement, ActionAggregateElement, ActionGroupElement, ActionExistsElement, ActionNotElement, ActionForAllElement)

Matches a rule element to an appropriate action based on the concrete type of the element. Type-safe implementation of discriminated union for rule elements.

Namespace:  NRules.RuleModel
Assembly:  NRules.RuleModel (in NRules.RuleModel.dll) Version: 0.9.3
Syntax
C#
public static void Match(
	this RuleElement element,
	Action<PatternElement> pattern,
	Action<AggregateElement> aggregate,
	Action<GroupElement> group,
	Action<ExistsElement> exists,
	Action<NotElement> not,
	Action<ForAllElement> forall
)

Parameters

element
Type: NRules.RuleModelRuleElement
Rule element to match.
pattern
Type: SystemActionPatternElement
Action to invoke on the element if the element is a PatternElement.
aggregate
Type: SystemActionAggregateElement
Action to invoke on the element if the element is an AggregateElement.
group
Type: SystemActionGroupElement
Action to invoke on the element if the element is a GroupElement.
exists
Type: SystemActionExistsElement
Action to invoke on the element if the element is an ExistsElement.
not
Type: SystemActionNotElement
Action to invoke on the element if the element is a NotElement.
forall
Type: SystemActionForAllElement
Action to invoke on the element if the element is a ForAllElement.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type RuleElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also