Boosting the Performance of an ASP.NET Application Using StringBuilder Class
page 4 of 7
by Brett Burridge
Feedback
Average Rating: 
Views (Total / Last 10 Days): 29536/ 46

Using the StringBuilder class

The StringBuilder class is a member of the System.Text namespace and can be instantiated using the following code.

Listing 1

Dim NewStringBuilder As New System.Text.StringBuilder

Once an instance of the class has been instantiated, text may be added to the class by using the Append method, as shown below.

Listing 2

NewStringBuilder.Append("Hello")

Subsequent text may be concatenated to the text already contained in the class by making further uses of the Append method.

Listing 3

NewStringBuilder.Append("World")

Finally, once all of the concatenations have been performed, the entire text may be accessed using the ToString() method of the class.

Listing 4

NewStringBuilder.ToString()

Note that the StringBuilder class contains a number of other methods and properties that are beyond the scope of this article.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-02-26 6:55:52 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search