String Management

In your applications you would come across the need for concatenating strings.  The best ways will be

1. Using the += operator. Use the += operator when the number of appends is known.

2. String Builder. Use the String Builder object when the number of appends is unknown. Treat StringBuffer as a reusable buffer.

3. Response.Write . Use the Response. Write method. It is one of the fastest ways to return output back to the browser.

Use the following guidelines when you are managing your string

1. Use Response.Write for formatting output.

2. Use StringBuilder for temporary buffers.

3. Use HttpTextWriter when building custom controls.


Ref: Improving .NET Performance and Scalability







Hide 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.