VB.NET := Operator

北慕城南 提交于 2019-11-29 10:24:44

It is used to assign optional variables, without assigning the previous ones.

sub test(optional a as string = "", optional b as string = "")
   msgbox(a & b)
end sub

you can now do

test(b:= "blaat")
'in stead of
test("", "blaat")

It assigns the optional parameter "variable" the value 2.

VB.NET supports this syntax for named (optional) parameters in method calls. This particular syntax informs Class.Function that its parameter variable is to be set to 2 (1 + 1).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!