title: How to make StringBuilder empty again in .NET 3.5 ?
body: <p>I have a loop where i create some string value based on certain conditions. I did place StringBuilder object outside of the loop and each time i have new row in loop i need to clear StringBuilder appended values for this row.</p>
  
  <p>How do i clear those?</p>
  
  <pre><code>        StringBuilder sb = new StringBuilder();
  
          foreach (DataRow row in recipientsList.Rows)
          {
              sb.Length = 0;
              sb.Append("&lt;ul&gt;");
              if (row["needsToActivate"] == "1")
              {
                  sb.AppendFormat("&lt;li&gt;{0}&lt;/li&gt;", getUsersWithoutActivationTemplate());
              }
              if (row["needsToEnterSite"] == "1")
              {
                  sb.AppendFormat("&lt;li&gt;{0}&lt;/li&gt;", getUsersWithoutEnteringWebsiteForTwoWeeksTemplate());
              }
              if (row["needsPicture"] == "1")
              {
                  sb.AppendFormat("&lt;li&gt;{0}&lt;/li&gt;", getUsersWithoutPicturesTemplate());
              }
              if (row["needsText"] == "1")
              {
                  sb.AppendFormat("&lt;li&gt;{0}&lt;/li&gt;", getUsersWithoutTextTemplate());
              }
              if (row["needsCharacteristic"] == "1")
              {
                  sb.AppendFormat("&lt;li&gt;{0}&lt;/li&gt;", getUsersWithoutCharateristicsTemplate());
              }
              if (row["needsHobby"] == "1")
              {
                  sb.AppendFormat("&lt;li&gt;{0}&lt;/li&gt;", getUsersWithoutHobbiesTemplate());
              }
              sb.Append("&lt;/ul&gt;");
  }
  </code></pre>
  
  <p>Code with accepted answer;</p>