Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm a C# developer working on a VB.NET project, and VS keeps trying to get me to use the := thingie when I call a function with a ByRef parameter like so:

While reader.Read()
HydrateBookFromReader(reader:=???)

the HydrateBookFromReader function has the following signature:

Public Function HydrateBookFromReader(ByRef reader As SqlDataReader) As Book

Why does intellisense keep insisting that I use that := construction, and what is it for?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
762 views
Welcome To Ask or Share your Answers For Others

1 Answer

In VB, the := is used in specifying named parameters.

Contact(Address:="2020 Palm Ave", Name:="Peter Evans")

This is especially useful for specifying optional parameters.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...