Tuesday, April 30, 2013

Reuse a StringBuilder object after clearing the TEXT - Simplest way - in older .net frameworks..

StringBuilder doesn't have a Clear() to clear the text for .net framework 2.0. There are different ways to clear the text, which are following:

1. Use Remove() method and give full length of text to remove.
2. Use Replace() method and replace the characters with "".


3. And the EASIEST SOLUTION is just set the builder.length = 0;

check it out.

No comments:

Post a Comment