G
Guest
Could anyone show me the code that allows me reset a Stringbuilder back to
either null or nothing or a blank space?
either null or nothing or a blank space?
Ken Cox said:Hi Paul,
It looks like you can set the Length to zero or just use New again.
Here's a little demo:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim sb As New StringBuilder
sb.Append("!", 50)
sb.Append(": Length is now " & sb.Length.ToString)
Label1.Text = sb.ToString
sb.Length = 0
Label2.Text = "After Length=0:" & sb.ToString
sb = New StringBuilder
End Sub
Ken
Microsoft MVP [ASP.NET]
Paul said:Could anyone show me the code that allows me reset a Stringbuilder back to
either null or nothing or a blank space?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.