tags:

views:

103

answers:

2

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.

+12  A: 

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

recursive
+1 for the same answer ;)
Adam Robinson
ahh it all make sense! Thanks.. not a big deal but for some reason I just had to know.
OneSmartGuy
They are particularly useful with optional arguments. It allows you to leave out arguments at the start of the argument list, and specify values for arguments at the end of the argument list.
MarkJ
+5  A: 

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.

Adam Robinson
+1 for a good description
OneSmartGuy