OneSmartGuy
OneSmartGuy

Reputation: 2939

What is the definition of ":=" in vb

I came across some sample code in VB.Net which I have some experience with and kinda having a duh moment figuring out the meaning of :=.

RefreshNavigationImages(bForward:=True, startIndex:=-1)

The sig for this method is RefreshNavigationImages(boolean, int). Is this a default value if null? Like "bIsSomething ?? false"?

Tried to bing/google but they just don't like searching for operators especially if it's only 2 chars.

Upvotes: 2

Views: 414

Answers (2)

Adam Robinson
Adam Robinson

Reputation: 185623

The := indicates the use of named parameters. Rather than relying on the order of the parameters in the method declaration, named parameters allow you to specify the correlation of parameters to values by specifying the name of the parameter.

Upvotes: 5

recursive
recursive

Reputation: 86064

They are named parameters. They let you specify values for arguments in function calls by name rather than order.

Upvotes: 12

Related Questions