VB.NET: = Operator

What does the following mean?

Class.Function(variable := 1 + 1) 

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

+7
source share
3 answers

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

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

now you can do

 test(b:= "blaat") 'in stead of test("", "blaat") 
+11
source share

It sets the optional parameter "variable" to 2.

0
source share

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

0
source share

All Articles