Prevent Thread Exceptions in ASP.NET

In ASP.NET, if you see Exception messages like this: Thread was being aborted. Coming from: System.Web.HttpResponse.Redirect This is due to the default behavior of the Redirect call and it always throws this exception that is usually absorbed by ASP.NET. You might see this if you are using Exception logging in your application. So make sure … Continue reading Prevent Thread Exceptions in ASP.NET

Extension Methods

Starting in .NET 3.5, a new feature was added called Extension Methods. Microsoft defines them as: Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they … Continue reading Extension Methods

The Using Pattern

When I teach and speak at conferences, one thing I stress a lot is releasing object resources as soon as possible! This allows the garbage collector to remove the object from the memory heap faster and lowers the memory footprint of the application. So, all objects that expose a finalizer should also have a method … Continue reading The Using Pattern

Checking a DataTable for Data

Whenever you retrieve a DataTable from a data source, there no guarantee that there is actual data in it. Before you start looking for rows, you should always validate that that is it's not null and also there are rows. Here is a easy way to do it using extensions. public static class DataTableExtensions   … Continue reading Checking a DataTable for Data

Quickly Finding Items in Visual Studio 2010

There is a new shortcut in VS2010 that makes it really simple to find any item in your solution very quick and easy. Simply type Ctrl-Comma and this dialog will appear: Start typing what you are looking for and this will quickly list all items that contain what you have typed (similar to Google Suggest).

How to Easily Access Visual Studio Windows

Here is a great Visual Studio keyboard shortcut. Do you work with lots of VS windows and want to switch between them without grabbing the mouse? Press and hold CTRL+TAB. You’ll get a popup with all your open Visual Studio windows, including tool windows. Then you can use TAB to scroll between them, or arrow … Continue reading How to Easily Access Visual Studio Windows