LINQ: Where are my extension methods?

The powerful Extension Methods due to LINQ have made our development really simple and easy. However in some cases these methods are not available as depicted in the following screenshot.

Here are a few scenarios in which we may find our extension methods missing:

  • Iterating through all the controls in a Windows Form (or any other container control) via their Controls collection
  • Iterating through items in our classic non-generic collections (e.g. ArrayList) under System.Collections namespace
  • Iterating through Columns in a DataGridView control
  • Iterating through Matches while working with Regular expressions
  • Retrieving enumeration values via Enum.GetValues

Read the rest of this entry »

TSQL: Error handling with Try Catch from a .NET perspective

Starting with SQL 2005, we can handle unexpected situations in our TSQL scripts/procedures/functions in an structured manner using the famous Try/Catch methodology, similar to what we are used to in our object oriented programming languages (C#, Java, etc). This post will describe certain similarities and how to enjoy the features that look absent at the first look. The MSDN document that describes error handling in TSQL in much detail is: Using TRY…CATCH in Transact-SQL
Read the rest of this entry »