What's the difference between these two calls..
Code:
s.Account.LastIP = String.Copy(s.RemoteIP)
-and-
s.Account.LastIP = [String].Copy(s.RemoteIP)
I haven't quite figured out what the brackets do...
Printable View
What's the difference between these two calls..
Code:
s.Account.LastIP = String.Copy(s.RemoteIP)
-and-
s.Account.LastIP = [String].Copy(s.RemoteIP)
I haven't quite figured out what the brackets do...
Aye Edneeis,
I referenced that before I posted, I am still unclear with this concept. You said that you use brackets in a namespace where an object could have two meanings? Where else in a routine would a String/[String] have any other meaning but being a string. A rose by any other name will still smell the same won't it? I guess what I'm asking for is an example on where you would be required to wrap a String in brackets..
The only situation I know the sqaure brackets '[]' are used is where you want to use a word that may have another meaning. An example is:
VB Code:
private sub [Next]() 'method implementation ' End Sub
Without the square brackets, an exception occures because 'Next' is a keyword.
'hope it helps...
Where did you see it used? It could be part of some sort of naming convention that they use. For String there doesn't seem to be a big need for the bracets but there are some needs:
VB Code:
Imports System.Data.DbType Public Class Example Public Shared Sub Test() Dim x As String = String.Copy("Something") 'in order to use the String value of the DbType Enum we must bracet it since it is imported to that level Dim s As String = [String].ToString MsgBox(String.Format("x: {1}{0}s: {2}", ControlChars.NewLine, x, s)) End Sub End Class
I once saw it in a vb.net book, I cannot remeber the title now. I'm using it in the application I'm developing at hand.