[Gtk-sharp-list] how to clear System.Text.StringBuilder

Peter Johanson latexer at gentoo.org
Sat Jun 18 21:58:40 EDT 2005


On Sat, Jun 18, 2005 at 11:03:09PM +0000, Paulinho wrote:
> Hi,
> 
> I'm trying clean a StringBuilder....
> 
> code:
> 
> StringBuilder IsqlSelect = new StringBuilder();
> 
> IsqlSelect.Append("Hi Monkeys");
> ...
> ...
> IsqlSelect.Equals(string.Empty); //I try this too: IsqlSelect.Equals("");
> IsqlSelect.Append("Bye Monkeys");
> 
> Console.Write(IsqlSelect.ToString()); // I hope "Bye Monkeys", but "Hi
> MonkeysBye Monkeys" is the result

Equals is for testing equality. Easiest way is to set Length = 0.

IsqlSelect.Length = 0;

*poof*. the string goes away!

-pete


-- 
Peter Johanson
<latexer at gentoo.org>


More information about the Gtk-sharp-list mailing list