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

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

Вопрос

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?

Это было полезно?

Решение 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.

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top