RSS

String vs. String()

Fri, Aug 15, 2008

ASP.NET, Code

I noticed something today, when you add the () to the end of the word String it actually instantiates an array as opposed to just the word String. Here is an example that depicts that:

Dim strThemesFolder As String = Server.MapPath("~contentthemes")
'Notice the Array below, a regular string wouldn't be able to hold all those values

Dim strThemeFolders As String() = Directory.GetDirectories(strThemesFolder)
Dim strFolderName As String
For Each strFolderName In strThemeFolders
      Response.Write(strFolderName)
Next
Share and Enjoy:
  • Facebook
  • Twitter
  • MySpace
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Yahoo! Buzz
, ,

Comments are closed.