Syntax/Mean of the following

  • Thread starter Thread starter kevininstructor
  • Start date Start date
K

kevininstructor

I have seen the following code, specifially an object or reference will be
surrounded with square brackets and can not find any documentation to
explain the syntax for the usage. Can someone tell me the reasoning behind
this?

Thanks
Kevin
[Assembly] i.e.
Dim asm As System.Reflection.[Assembly] =
System.Reflection.[Assembly].GetExecutingAssembly()


or

For Each a As [Assembly] In AppDomain.CurrentDomain.GetAssemblies
PopulateAssemblySummary(a)
Next

or
[string]

Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer
Implements IComparer.Compare
Dim intResult As Integer = _
[String].Compare(CType(x,
ListViewItem).SubItems(_intCol).Text, _
CType(y, ListViewItem).SubItems(_intCol).Text)

If _IsAscending Then
Return intResult
Else
Return -intResult
End If
End Function
 
Thanks Greg, as Chris also pointed out. I wasn't sure why someone would code
that way I guess was the main reason for asking, this makes things clearer.

Greg Burns said:
Reserved keywords have to be escaped with brackets.

Greg

I have seen the following code, specifially an object or reference will be
surrounded with square brackets and can not find any documentation to
explain the syntax for the usage. Can someone tell me the reasoning behind
this?

Thanks
Kevin
[Assembly] i.e.
Dim asm As System.Reflection.[Assembly] =
System.Reflection.[Assembly].GetExecutingAssembly()


or

For Each a As [Assembly] In AppDomain.CurrentDomain.GetAssemblies
PopulateAssemblySummary(a)
Next

or
[string]

Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer
Implements IComparer.Compare
Dim intResult As Integer = _
[String].Compare(CType(x,
ListViewItem).SubItems(_intCol).Text, _
CType(y, ListViewItem).SubItems(_intCol).Text)

If _IsAscending Then
Return intResult
Else
Return -intResult
End If
End Function
 
Sorry, missed Chris' post. Very concise.

Peter Merwood started a strange thread last month on a simliar subject that
you may want to take a look:

http://tinyurl.com/5e3mt

Greg


Thanks Greg, as Chris also pointed out. I wasn't sure why someone would
code
that way I guess was the main reason for asking, this makes things
clearer.

Greg Burns said:
Reserved keywords have to be escaped with brackets.

Greg

I have seen the following code, specifially an object or reference will be
surrounded with square brackets and can not find any documentation to
explain the syntax for the usage. Can someone tell me the reasoning behind
this?

Thanks
Kevin
[Assembly] i.e.
Dim asm As System.Reflection.[Assembly] =
System.Reflection.[Assembly].GetExecutingAssembly()


or

For Each a As [Assembly] In AppDomain.CurrentDomain.GetAssemblies
PopulateAssemblySummary(a)
Next

or
[string]

Public Function Compare(ByVal x As Object, ByVal y As Object) As
Integer
Implements IComparer.Compare
Dim intResult As Integer = _
[String].Compare(CType(x,
ListViewItem).SubItems(_intCol).Text, _
CType(y, ListViewItem).SubItems(_intCol).Text)

If _IsAscending Then
Return intResult
Else
Return -intResult
End If
End Function
 
Back
Top