Rule Class (System.Workflow.Activities.Rules)

Switch View :
ScriptFree
.NET Framework Class Library
Rule Class

Defines a condition with an associated set of actions to perform.

Inheritance Hierarchy

System.Object
  System.Workflow.Activities.Rules.Rule

Namespace:  System.Workflow.Activities.Rules
Assembly:  System.Workflow.Activities (in System.Workflow.Activities.dll)
Syntax

Visual Basic
<SerializableAttribute> _
Public Class Rule
C#
[SerializableAttribute]
public class Rule
Visual C++
[SerializableAttribute]
public ref class Rule
F#
[<SerializableAttribute>]
type Rule =  class end

The Rule type exposes the following members.

Constructors

  Name Description
Public method Rule() Initializes a new instance of the Rule class.
Public method Rule(String) Initializes a new instance of the Rule class using the name of the Rule.
Public method Rule(String, RuleCondition, IList<RuleAction>) Initializes a new instance of the Rule class using the name of the Rule, the rule condition, and a list of THEN actions.
Public method Rule(String, RuleCondition, IList<RuleAction>, IList<RuleAction>) Initializes a new instance of the Rule class using the name of the Rule, the rule condition, a list of THEN actions, and a list of ELSE actions.
Top
Properties

  Name Description
Public property Active Gets or sets a value that indicates whether the Rule should be evaluated.
Public property Condition Gets or sets a RuleCondition for the Rule to evaluate.
Public property Description Gets or sets a description of the Rule.
Public property ElseActions Gets a collection of RuleAction classes to perform in the ELSE case.
Public property Name Gets or sets the name of the Rule.
Public property Priority Gets or sets a value that indicates the order in which a Rule should be run.
Public property ReevaluationBehavior Gets or sets a value indicating whether a Rule can be reevaluated.
Public property ThenActions Gets a collection of RuleAction classes to perform in the THEN case.
Top
Methods

  Name Description
Public method Clone Creates a deep copy of the current Rule.
Public method Equals Determines whether this instance of Rule and the object passed as the parameter have the same value. (Overrides Object.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Returns the hash code for this instance. (Overrides Object.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
Remarks

A Rule consists of a RuleCondition and one or both ThenActions or ElseActions collections.

Examples

The following example shows how to create a named Rule.

C#
private Rule firstRule = new Rule("firstRule");
Version Information

.NET Framework

Supported in: 4, 3.5, 3.0
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference