Differences of the usage of the Square brackets [ ] beetwen "As String" and "As [String]"? [duplicate]

StackOverflow https://stackoverflow.com/questions/17417629

Question

Someone can explain me which are the differences between using the Square brackets [ ] as this:

Private Function FindItem([ListView] As [ListView], [ColumnIndex] As [Int32], [SearchString] As [String], Optional [IgnoreCase] As [Boolean] = False) As Boolean

...And this else:

Private Function FindItem(ListView As ListView, ColumnIndex As Integer, SearchString As String, Optional ByVal IgnoreCase As Boolean = False) As Boolean

Both works with the same passed arguments.

Where I can learn about this strange vb.net operator?

Was it helpful?

Solution 2

Keywords as variables. Documentation

I don't believe in using them, just name your variables something meaningful.

Dim _name As String ' better choice - has meaning now.

OTHER TIPS

In your example, there is no difference. The brackets are used to allow the use of reserved words.

Example :

Dim [String] As String = Nothing
[String] = "My String has a poor name"

The [] around the names allows you to use a reserved word.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top