Partilhar via


How to: Use Conditions Through Code

You can create conditions in C# or Visual Basic. A C# or Visual Basic condition is a code-separation handler that sets a Boolean value in the Result property. It is compiled and becomes part of the assembly. The runtime engine executes the method and uses the Result property as the result of the condition evaluation.

The following is an example of a C# code condition that evaluates whether some custom property value is greater than 10.

private void EvaluateCondition(object sender, ConditionalEventArgs e)
{
    if (this.CustomPropertyValue > 10)
    {
        e.Result = true;
    }
    else
    {
        e.Result = false;
    }
}

See Also

Reference

ConditionalEventArgs
System.Workflow.Activities.Rules

Concepts

Using Conditions in Workflows