VB.NET := Operator

前端 未结 3 1126
予麋鹿
予麋鹿 2020-12-19 06:07

What does the following mean?

Class.Function(variable := 1 + 1)

What is this operator called, and what does it do?

3条回答
  •  时光取名叫无心
    2020-12-19 06:45

    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")
    

提交回复
热议问题