Does anyone know if the SqlDataAdapter.Dispose method actually closes or disposes any SqlConnections? I loaded up Reflector and I see that SqlDataAdapter inherits from DbDataAdapter. If I disassemble and look at the dispose method in that class, there appears to be no disposal of any SqlConnections. I suppose I could write a test for this, […]
Category: .net
How do I get the first element from an IEnumerable in .net?
I often want to grab the first element of an IEnumerable<T> in .net, and I haven’t found a nice way to do it. The best I’ve come up with is: foreach(Elem e in enumerable) { // do something with e break; } Yuck! So, is there a nice way to do this?