Which code segment should you insert at line 05?

You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
You plan to create a RuleSet class named ruleSet.

You write the following code segment in the RuleSet class.

Int32 age;
Boolean adult;

You write the following code segment. (Line numbers are included for reference only.)

01 RuleSet ruleSet = new RuleSet();
02 Rule ageRule = new Rule("AgeRule");
03 CodeThisReferenceExpression thisRef =
04 new CodeThisReferenceExpression();
06 CodeBinaryOperatorExpression ageValueTest = new
07 CodeBinaryOperatorExpression();
08 ageValueTest.Left = ageRef;
09 ageValueTest.Operator =
10 CodeBinaryOperatorType.GreaterThanOrEqual;
11 ageValueTest.Right = new
12 CodePrimitiveExpression(18);
13 ageRule.Condition = new
14 RuleExpressionCondition(ageValueTest);
15 CodeAssignStatement ageRuleAction = new
16 CodeAssignStatement(adultValueRef, new
17 CodePrimitiveExpression(true));
18 ageRule.ThenActions.Add(new
19 RuleStatementAction(ageRuleAction));
20 ruleSet.Rules.Add(ageRule);

You need to add a rule that sets the value of the adult field to true if the value of the age field is greater than or equal to 18. You also need to assign the highest priority to this rule.

Which code segment should you insert at line 05?

You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
You plan to create a RuleSet class named ruleSet.

You write the following code segment in the RuleSet class.

Int32 age;
Boolean adult;

You write the following code segment. (Line numbers are included for reference only.)

01 RuleSet ruleSet = new RuleSet();
02 Rule ageRule = new Rule("AgeRule");
03 CodeThisReferenceExpression thisRef =
04 new CodeThisReferenceExpression();
06 CodeBinaryOperatorExpression ageValueTest = new
07 CodeBinaryOperatorExpression();
08 ageValueTest.Left = ageRef;
09 ageValueTest.Operator =
10 CodeBinaryOperatorType.GreaterThanOrEqual;
11 ageValueTest.Right = new
12 CodePrimitiveExpression(18);
13 ageRule.Condition = new
14 RuleExpressionCondition(ageValueTest);
15 CodeAssignStatement ageRuleAction = new
16 CodeAssignStatement(adultValueRef, new
17 CodePrimitiveExpression(true));
18 ageRule.ThenActions.Add(new
19 RuleStatementAction(ageRuleAction));
20 ruleSet.Rules.Add(ageRule);

You need to add a rule that sets the value of the adult field to true if the value of the age field is greater than or equal to 18. You also need to assign the highest priority to this rule.

Which code segment should you insert at line 05?

A.
CodePropertyReferenceExpression ageRef = new CodePropertyReferenceExpression(thisRef, "age");CodePropertyReferenceExpression adultValueRef = new CodePropertyReferenceExpression(thisRef, "adult");ageRule.Priority = Int32.MaxValue;

B.
CodeFieldReferenceExpression ageRef = new CodeFieldReferenceExpression(thisRef, "age");CodeFieldReferenceExpression adultValueRef = new CodeFieldReferenceExpression(thisRef, "adult");ageRule.Priority = Int32.MaxValue;

C.
CodeFieldReferenceExpression ageRef = new CodeFieldReferenceExpression(thisRef, "age");CodeFieldReferenceExpression adultValueRef = new CodeFieldReferenceExpression(thisRef, "adult");ageRule.Priority = 0;

D.
CodePropertyReferenceExpression ageRef = new CodePropertyReferenceExpression(thisRef, "age");CodePropertyReferenceExpression adultValueRef = new CodePropertyReferenceExpression(thisRef, "adult");ageRule.Priority = Int32.MinValue;



Leave a Reply 0

Your email address will not be published. Required fields are marked *