Using async / await

added by bnaya
1/14/2012 11:02:03 PM

6 Kicks, 235 Views

Using async / awaitUsing async / await this post will discuss parallel disposal. whenever we want to dispose a parallel execution upon completion we can't use the convenient using keyword. for example, the following code may be dispose the command before completion:Very bad Code Snippetusing (var conn = newSqlConnection(CONN_STR))using (var cmd = newSqlCommand("Select * from Employee", conn)) { conn.Open(); cmd.BeginExecuteReader(ar => {int affected = cmd.EndExecuteNonQuery(ar); ...


1 comments

bsenoff
1/14/2012 7:47:41 PM