PHP:
if(($a = $toto) == 'test') echo $a;
VB.net
Dim a as string = toto
if a.equals("test") then console.writeline(a)
我喜欢“一线”代码设计,那么,是否有可能在vb.net中做到这一点?
答案 0 :(得分:2)
这将是多行而不是
Dim a As String = "test"
Dim b As String = a
if (b.equals("test")) then console.writeline(b)
或者亚历山大建议你可以使用这样的一个衬垫(实际上编译器实际上不是一个衬垫)
Dim a As String = "test", b As String = a
if (b.equals("test")) then console.writeline(b)
答案 1 :(得分:0)
您可以使用以下内容......
我还没有这样做,但我希望它能帮到你..
Option Explicit Off
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ((ss = "test") = "test") Then MessageBox.Show("hi")
End Sub
End Class