David,
In addition to Adian's comments. The formatting allowed is explained here:
http://msdn.microsoft.com/library/d...n-us/cpguide/html/cpconformattingoverview.asp
Specifically:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconcompositeformatting.asp
In addition to String.Format: Console.WriteLine & TextWriter.WriteLine also
support format specfiers. Also a number of controls in ASP.NET support a
format property that is used during data binding.
Using a format specifier is very useful for internationalization, as the
place holders in the format string do not need to be in consecutive order.
Const firstName As String = "{0} {1} {2}"
Const lastName As String = "{2}, {0} {1}"
Dim s As String
Dim format As String
format = firstName
s = String.Format(format, "Jay", "B.", "Harlow")
format = lastName
s = String.Format(format, "Jay", "B.", "Harlow")
Where the format (firstName or lastName) is supplied from outside the
routine (such as a resource file (.RESX)). Notice that the three parts of
the name are supplied in the same order to String.Format, however the format
string itself changed for each "format" we wanted to support...
Hope this helps
Jay
David Morris said:
Hi,
Could somebody please explain what the following line of code means?
String.Format("{0}\{1}.{2:00}", C:\, myfile.txt, 1)
It's actually the first argument that I don't understand. What is the
purpose of "{0}\{1}.{2:00}"? I've been using VB .NET for a year now, and
have never come across anything like this?