简体   繁体   English

在VB .Net 3.5 VS2012中无法识别if()

[英]if() not recognized in VB .Net 3.5 VS2012

I just asked a question , where the answer proposed to use the If() function. 我只是问了一个问题 ,答案在哪里建议使用If()函数。

I tried in my Visual Studio, but it seems not present... 我在Visual Studio中尝试过,但似乎不存在...

Here is a screenshot of the Intellisense : 这是Intellisense的屏幕截图: 在此处输入图片说明

It only shows me the classical If structure. 它只向我展示了经典的If结构。

When I write it out completely 当我完全写出来

If(True, Debug.Write("A"), Debug.Write("B"))

I get a syntax error, saying : 我收到语法错误,说:

If must end by a corresponding End If 如果必须以相应的结束结束

What am I missing here ? 我在这里想念什么?

.Net Framework 3.5 .Net Framework 3.5

Visual Studio 2012 Express Visual Studio 2012 Express

The project is a Console Application and I tried also in Winforms... 该项目是一个控制台应用程序,我也在Winforms中尝试过...

If() 运算符返回一个值,请尝试:

Debug.Write(If(True, "A", "B"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM