开发者

Switch of string in Workflow Foundation issue

开发者 https://www.devze.com 2023-03-24 00:23 出处:网络
I\'ve encountered a very weird problem with WF4: when I use Switch activity and make the decision on the value of a string variable somehow WF开发者_开发百科 treats argument to the Switch as a string,

I've encountered a very weird problem with WF4: when I use Switch activity and make the decision on the value of a string variable somehow WF开发者_开发百科 treats argument to the Switch as a string, not the name of the variable. And consequently I get incorrect results. Steps to repro:

- 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
And suddenly here we get a message box with "default" text, not the one for the testText case


You need to use the value of test without the quotes. The cases contain a literal value, not an expression. And yes I find this confusing as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消