开发者

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

开发者 https://www.devze.com 2023-04-09 06:53 出处:网络
In VB.NET, you can invoke methods (or add attributes) with optional parameters like so: DoSomething(FirstName:=\"Bob\", LastName:=\"Smith\")

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号