Checking if stringbuilder is empty
To check if a stringbuilder is empty, use the Length property.
i.e
private readonly StringBuilder builder = new StringBuilder();
public void AddSomeString(string someString)
{
if (builder.Length > 0) builder.Append(", ");
builder.Append(someString);
}
public string CommaSeparatedString
{
get
{
return builder.ToString();
}
}
About this entry
You’re currently reading “Checking if stringbuilder is empty,” an entry on Ronald Widha
- Published:
- 07.10.08 / 11pm
- Category:
- Articles

View Comments
Jump to comment form | comments rss [?] | trackback uri [?]