vb.netsyntaxterminologycolon-equals

What is the := operator called in VB.NET?


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?


Solution

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