DCSIMG
Task,continuewith - Bnaya Eshet

Bnaya Eshet

Disclaimer

Browse by Tags

All Tags » Task » continuewith (RSS)
Using async / await
Using 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 Snippet using ( var conn = new SqlConnection (CONN_STR)) using ( var cmd = new SqlCommand ( "Select * from Employee" , conn)) { conn.Open(); cmd.BeginExecuteReader(ar => { int affected = cmd.EndExecuteNonQuery(ar); }); } the...
the concept of async \ await
the concept of async \ await in this post I will survey the new .NET 4.5 / C# 5 concept of async / await. I will focus on how to understand what is really happens behind the new async / await syntax. What's it all about? the new async / await syntax is using the C# syntactic compiler to generate async operation from code that is looking very much like a synchronous code. but before we start we should discus the new C# 5  syntax. the syntax include 2 keywords: async - which is only a marker...
What is the cost of async/await?
What is the cost of async/await? .NET 4.5 (C# 5) had brought the new async/await syntax. I will cover async/await syntax in more details in future post, but in the meanwhile in case that you are not yet familiar with this syntax, what's  you should have to know is that the syntactic compiler transform that syntax ( and the lines that follow the await keyword ) into IL, the generated IL is following the concept of the TPL ContinueWith . the syntactic compiler is actually generating fair amount...