Two interesting lessons. First; with lists; try to think in terms of T
; for full details see here, but in short you need to use:
public void Foo(IList data) where T : SomeBaseClassOrInterface {}
and not:
public void Foo(IList data) {}
Second: watch for the edge cases ;-p
Can you see the trap here?
static void Foo() where T : new()
{
T t = new T();
Console.WriteLine(t.ToString()); // works fine
Console.WriteLine(t.GetHashCode()); // works fine
Console.WriteLine(t.Equals(t)); // works fine
// so it looks like an object and smells like an object...
// but this throws a NullReferenceException...
Console.WriteLine(t.GetType()); // BOOM!!!
}