Validate your ODATA Service

If you you are writing an ODATA service, it's a good idea to validate that it's implemented correctly so other platforms like WP7 and iPhone can easily consume it. Here is a site from the ODATA team to do just that: http://services.odata.org/validation/

Type Design: Equals and HashCode

Good type design dictates that the Equals should always be overridden. This is actually a FXCop violation but 99.99% of types that I see, never has it (or GetHashCode).  Overriding Equals is pretty easy. Public Overloads Function Equals(ByVal obj As [Object] ) As Boolean Try Dim ci = DirectCast (obj, ComputerInfo ) Return (ci.OSFullName = … Continue reading Type Design: Equals and HashCode

See All of Your Code!

No matter how big your screen resolution is, it seems we write a line of code wider than the width of the code editor window in Visual Studio. One solution is to break up your line using carriage returns (now works without the “_” character in VB.NET too). This issue with this is that every … Continue reading See All of Your Code!

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

Finding Controls in ASP.NET

Find ASP.NET Controls easily!

Formatting T-SQL

As you might know I'm really picky when it comes to formatting code... heck, I event wrote a book on it! This even extends to T-SQL. I have worked at companies that had stored procedures that were formatted so poorly that I could not follow it at all. Thankfully I found a very cool web … Continue reading Formatting T-SQL