Viewing source for Recipe1511vb.aspx

<%@ Page %>
<script Language="vb" runat="server">
Private Sub Page_Load(sender As Object, e As System.EventArgs)
   Dim startTime, endTime As DateTime
   Dim output As String = ""
   Dim span As TimeSpan
   Dim i As Integer
   
   ' build a string using concatenation
   startTime = DateTime.Now
   For i = 1 To 9999
      output += i.ToString() + " "
   Next i
   'Response.Write(output);
   endTime = DateTime.Now
   span = New TimeSpan(endTime.Ticks - startTime.Ticks)
   Response.Write(("<hr>Time Using Concatenation: " + span.TotalSeconds.ToString() + "<hr>"))
   
   ' build a string using stringbuilder
   startTime = DateTime.Now
   Dim sb As New System.Text.StringBuilder(10000)
   For i = 1 To 9999
      sb.Append(i.ToString())
      sb.Append(" ")
   Next i
   'Response.Write(sb.ToString());
   endTime = DateTime.Now
   span = New TimeSpan(endTime.Ticks - startTime.Ticks)
   Response.Write(("<hr>Time Using StringBuilder: " + span.TotalSeconds.ToString() + "<hr>"))
End Sub 'Page_Load 
</script>