IIF 内可以进行赋值,为什么不起作用?
工作:
publicity.Target = IIF(radioTarget1.Checked, "_blank", "_self").toString
不起作用:
IIF(radioTarget1.Checked, publicity.Target = "_blank", publicity.Target = "_self")
为什么第二个选项不起作用?
Work :
publicity.Target = IIF(radioTarget1.Checked, "_blank", "_self").toString
Doesn't work :
IIF(radioTarget1.Checked, publicity.Target = "_blank", publicity.Target = "_self")
Why isn't the second option working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因为您在函数调用内执行的不是赋值,而是比较。
它的作用与以下相同:
Because it's not assignments you are doing inside the function call, it's comparisons.
It does the same as:
IIF 是一个函数,而不是一个语言特性。
后两个参数是函数的潜在返回值的对象......而不是代码块。
http://msdn.microsoft.com/en -us/library/27ydhh0d%28v=VS.90%29.aspx
IIF is a function, not a language feature.
The second two parameters are objects that are potential return values of the function... not a block of code.
http://msdn.microsoft.com/en-us/library/27ydhh0d%28v=VS.90%29.aspx