Mack & Seven's ASP.NET Tricks
Take Advantage of Output Caching-Page Scope
Caching is one of ASP.NET's great new features. It enables you to place frequently accessed documents and data into the memory cache.
Output Caching enables you to cache response content from a dynamically generated document and then serve this document to subsequent requestors for a set duration of time directly from the in memory cached version of it. Additionally, output caching enables you to create multiple representation of the same document. One method to do this is based on query string or post parameters.
Fragment Caching Method to cache portions of web forms by enabling output caching within one or more user controls included on a web form.
Take Advantage of Data Caching-Application Scopes
Data Caching can be used to insert objects such as a DataSet or Array into the cache. For example, you may have a DataSet that's data source is only updated once daily and it is used in more than one place within your web application. You can use data caching to place this DataSet into the cache for a 24 hour period and access it from anywhere within your application.
Use the StringBuilder for String Manipulation
String concatenation is a very easy task to do, but can also hurt the performance of your applications. You may or may not be aware of the fact that whenever you make a string modification to the base string data type (ex: adding, removing, replacing characters) a new string is created with each modification. The StringBuilder class solves this problem. The following code illustrates how to concatenate one string to another using the StringBuilder.
01: StringBuilder MySBuilder = new StringBuilder("My name is "); 02: MySBuilder.Append("Don Mack"); 03: Response.Write(MySBuilder.ToString());
The StringBuilder class also has methods to insert, append, remove, and replace characters.