在Workflow Foundation问题中切换字符串

时间:2011-07-29 13:48:01

标签: workflow-foundation-4

我遇到了WF4的一个非常奇怪的问题:当我使用Switch活动并以某种方式决定字符串变量的值时,WF将Switch的参数视为字符串,而不是变量的名称。因此我得到了不正确的结果。重现的步骤:

- create new WF
- add Sequence
- add Switch of String to the Sequence
- add a new string variable named, for instance, [testText] and set its default value to "test"
- set argument of the switch to testText
- create a case in the switch for "test" string and show msgbox on it
- create another case, let it be default case which shows another msgbox with "default" text
- run
突然,我们在这里得到一个带有“默认”文本的消息框,而不是testText案例的文本

1 个答案:

答案 0 :(得分:12)

您需要使用测试的值而不使用引号。案例包含文字值,而不是表达式。是的,我发现这也令人困惑。

相关问题