Home > Net >  Consult function expansion parameters used in square brackets is what mean?
Consult function expansion parameters used in square brackets is what mean?

Time:02-21

Specific such as:
The Function get string (HasSpaces as an integer, [Prompt as object]) as string



The expanding use in square brackets [Prompt as object] specific what meaning?

CodePudding user response:

Syntax error, is that right?
The Function get String (HasSpaces As an Integer, Prompt the As Object) As String
Some of the variables and key words of the same name, can add parentheses said he was not in the key words,

CodePudding user response:

Not very sure, generally expressed in [] vb.net to escape, tells the compiler that is variable, is not a keyword,
Such As keywords As As a variable name can be written As
Dim [As] the As Integer=0

CodePudding user response:

11111

CodePudding user response:

Optional parameters, I guess

If a function defined as
The Function get string (HasSpaces as an integer, optional byval Prompt as object=nothing) as string
End the function

When call get string will tip into
Get String (HasSpaces as an Integer, [Prompt as object=Nothing]) as a String
  • Related