Reputation: 5545
I try to understand delegates at the moment and stumbled across the following snippet:
Function [Select](ByVal numbers As List(Of Integer), ByVal filter As Filter) As List(Of Integer)
Dim result As New List(Of Integer)
For Each number In numbers
' call delegate
If filter(number) = True Then
result.Add(number)
End If
Next
Return result
End Function
I searched for an explanation but all I could find is this but that doesn't help me understand the snippet I found. Could anyone help me to understand what the square brackets [Select]
are for?
Upvotes: 4
Views: 934
Reputation: 5869
They are there because the Select
keyword is already used for Select... Case statements. Therefore the brackets are used to inform the compiler and IDE that you don't want to use the keyword, you just want it as 'normal' text (whatever that might be in the given context).
FYI, you have to do the same thing in SQL-Server too.
Upvotes: 5