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 equa开发者_如何学Pythonls 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?
It's not an operator - it's just the syntax for named arguments.
Those are Named Arguments.
http://msdn.microsoft.com/en-us/library/dd264739.aspx
精彩评论