Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
755 views
in Technique[技术] by (71.8m points)

vb.net - What is the use of the := syntax?

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

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

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...