0

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?

ElektroStudios
  • 19,105
  • 33
  • 200
  • 417

2 Answers2

3

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.

Danish Ashfaq
  • 446
  • 4
  • 11
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.
OneFineDay
  • 9,004
  • 3
  • 26
  • 37
  • Would it be correct to say that if the thing inside the square brackets is not actually a keyword, then the brackets have no effect? – M.M Dec 16 '15 at 05:00