Syntax/Mean of the following

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
 
K

kevininstructor

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
 
G

Greg Burns

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top