Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET 4.5 has new keywords await and async
WhatsApp
Jaish Mathews
12y
8.9
k
0
0
25
Blog
The .NET Framework 4.5 introduced an asynchronous programming concept referred to as a task. The await keyword is syntactical shorthand for indicating that a piece of code should asynchronously wait on some other piece of code. The async keyword represents a hint that you can use to mark methods as task-based asynchronous methods. A scenario like a report method should be executed asynchronously an dinside the method, fetching DB information should be synchronized. Here's how it should display
private
async
Task
ShowReport
(
)
{
var
result
=
await
DB.ExecuteNonQuery(<<some SP>>)
;
// Code to handle the report display
}
Above, bolded words are key. It's saying
ShowReport() will execute as async, but DB operation inside it will be synchronized.
See here
http://msdn.microsoft.com/en-us/library/hh191443(v=vs.110).aspx
more info.
.NET 4.5 has new keywords await and async
Up Next
Free ebook on VS.Net 2012 and ASP.Net 4.5
Ebook Download
View all
Coding Principles
Read by 2.7k people
Download Now!
Learn
View all
Membership not found