Everyone knows the using statement. The statement that deals with IDisposable interface for us in a clean to write way. There is however one feature of this statement that is almost never mentioned. The feature I'm talking allows for multiple objects initialization of variables. Usage looks as follows:
using (SqlConnection conn1 = new SqlConnection(),
conn2 = new SqlConnection())
{
}
This way, both conn1 and conn2 will be disposed - no need to write 2 nested usings.
There is a note about this feature on MSDN but I've not seen it mentioned anywhere else.