3

In VB.NET, you can invoke methods (or add attributes) with optional parameters like so:

DoSomething(FirstName:="Bob", LastName:="Smith")

...

<MyAttribute(SomeParam:=400)>
Public MyClass
    ...

I was trying to find out the name of the := operator, so I looked within MSDN's VB.NET 2010's Operators section and couldn't find it listed. Maybe it's not actually an operator, but instead something else?

I keep calling it the "colon equals operator" or the "parameter assignment notation" when talking to co-workers, but it would be nice to know what it is technically called. For example, I would call the << operator the "left bit-shift operator" and the <= operator the "greater-than-or-equal comparison operator." So then, what should := be called?

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
ckittel
  • 6,478
  • 3
  • 41
  • 71

2 Answers2

5

It's not an operator - it's just the syntax for named arguments.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
2

Those are Named Arguments.

http://msdn.microsoft.com/en-us/library/dd264739.aspx

asawyer
  • 17,642
  • 8
  • 59
  • 87