For i As Integer = 0 To 5
Dim sb As StringBuilder
If i = 0
sb = New StringBuilder(i .ToString())
Next i
Console.WriteLi ne(sb.ToString( ))
Next i
The above code gives the following output:
0
0
0
0
0
Kinda wierd how the StringBuilder (or any object) saves it state after the
first iteration of the loop. The StringBuilder's text stays the same and
doesn't re-initialize.
Comments?
Mythran
Dim sb As StringBuilder
If i = 0
sb = New StringBuilder(i .ToString())
Next i
Console.WriteLi ne(sb.ToString( ))
Next i
The above code gives the following output:
0
0
0
0
0
Kinda wierd how the StringBuilder (or any object) saves it state after the
first iteration of the loop. The StringBuilder's text stays the same and
doesn't re-initialize.
Comments?
Mythran
Comment