SqlConnection, Close and deconstructor: Internal .Net Framework Data Provider error 1.

Today I experienced the following issue: I had a class where I would open a SqlConnection, do some actions, and then in the deconstructor I closed the SqlConnection. ~Dumper() { this._sqlConnection.Close(); } Unfortunately every time my program ran it stopped with this error: (click to enlarge) Well it seems that you cannot close a SqlConnection […]

.NET 3.5 pager, generate pages from List<T>

A friend of mine asked me to generate pages from a List<T>. This is my implementation: using System; using System.Collections.Generic; using System.Linq; namespace Pager { static class Program { static void Main() { List<int> list = new List<int>(); //add 26 items for (int x = 0; x < 26; x++) { list.Add(x); } //generate pages […]