1

PHP:

if(($a = $toto) == 'test') echo $a;

VB.net

Dim a as string = toto
if a.equals("test") then console.writeline(a)

我喜欢“单行”代码设计,那么,是否可以在 vb.net 中做到这一点?

4

2 回答 2

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) 
于 2013-06-07T05:57:15.980 回答
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
于 2013-06-07T07:17:11.163 回答