Switch of string in Workflow Foundation issue

喜你入骨 提交于 2019-12-10 13:26:57

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/6874152/switch-of-string-in-workflow-foundation-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!