Hidden Secrets of C# Tip 1: Yield Return, Yield Break

If you ever wanted to return the generic collection of items from an method, what do you do? you may do like this..

public List<int> LoadEvenNumbers(){          List<int> items = new List<int>();          for(int i = 0; i<100;i++)          {                   if(i % 2 == 0) items.Add(i);                           }   }

But, there is […]

SELECT TOP … WITH TIES

Ever wanted to query a table and get all records that have one of the top 3 values? Let’s say you have a Books table where all your book details are stored.

You want to find the top 3 books that has the same price value, but you want to include “ties”. Let me […]

SQL Server Compact Toolbox

SQL Server Compact Toolbox is an add-in for Visual Studio 2010 which adds several features to help your SQL Server Compact development efforts:

Supports both version 3.5 and 4.0 of SQL Server Compact. Script tables, including data Script entire schema, optionally with data, both of SQL Server Compact and SQL Server 2005 or later databases […]

SQL Tips–Clear buffer from pool

DBCC DROPCLEANBUFFERS

Many times, we noticed that when we execute complex queries in query analyser, it takes time on first execution and subsequently execution time will be reduced for the maximum. Basically, SQL Statements are getting executed from cache rather than recompiling. Its the same case for stored procedure, instead of recompiling every time, it […]

Make Object ID – Visual Studio Debugger

“Make Object ID” is an option available with the Visual Studio Debugger to keep track of an object no matter it’s within scope or out of scope for the current context. We can create “Object ID” either from Locals, Autos or from Watch Windows. Object ID is a integer number followed by a pound (#) […]