Using String builder class effectively

An instance of String is said to be immutable because its value cannot be modified once it has been created. Methods that appear to modify a String actually return a new String containing the modification. Use the System.Text.StringBuilder class if it is necessary to actually modify the contents of a string-like object. the System.Text.StringBuilder object allows to create more efficient string-intensive code. More specifically, when you need to concatenate several strings together, you should use the StringBuilder'sAppend method. Depending on how many strings you are concatenating and how long they are, the code based on the StringBuilder can be even hundreds times faster than the standard concatenation operator.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish