VB.NET:=运算符

Kev*_*vin 7 vb.net optional-variables

以下是什么意思?

Class.Function(variable := 1 + 1)
Run Code Online (Sandbox Code Playgroud)

这个操作符叫什么,它做了什么?

Ikk*_*kke 11

它用于分配可选变量,而不分配先前的变量.

sub test(optional a as string = "", optional b as string = "")
   msgbox(a & b)
end sub
Run Code Online (Sandbox Code Playgroud)

你现在可以做

test(b:= "blaat")
'in stead of
test("", "blaat")
Run Code Online (Sandbox Code Playgroud)