Monday, August 24, 2009

Testing Linq

There is an amazing software called linqpad. It can help you test out your linq queries.

Other than that you might still feel the need to show the data returned from your query quickly.

Here's a code snippet that does just that:

public static void ShowInGrid(Object items)
{
Form form = new Form();
DataGrid dg = new DataGrid();
form.Controls.Add(dg);
dg.Dock = DockStyle.Fill;
dg.DataSource = items;
form.ShowDialog();
form.Dispose();

}

use at will :)