2017-05-04 52 views

回答

1

是的,用繩子插你可以使用表達式 - Interpolated Strings

Dim text = $"IsPositive = {If(number > 0, "true", "false"}" 

插值的字符串表達式通過更換 創建一個字符串包含與 表達式結果

的的ToString represenations表達式
0

VB等效三元運算符的是如果操作者(如從If語句不同)。

您可以直接從PHP到VB翻譯代碼:

Dim test = "X is" & If(x > 10, " > 10 ", " < 10 ") 

(我爲源明顯的錯誤一些修正,但我不熟悉PHP的,所以我可能無意中引入差異行爲)。