Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Async functions in C# using

Tags:

c#

I am trying to use the 'async' and 'await' keywords in VS C# 2010 Express but i can't seem to use this keyword. However, when I use this keyword in VS C# 2012 Professional, it can be used. Is there a special thing that I must download to use it?

like image 885
Bocky Avatar asked Aug 23 '12 06:08

Bocky


People also ask

What is async function in C?

In computer programming, the async/await pattern is a syntactic feature of many programming languages that allows an asynchronous, non-blocking function to be structured in a way similar to an ordinary synchronous function.

What is async function?

An async function is a function declared with the async keyword, and the await keyword is permitted within it. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.

Does C have asynchronous?

With the new C++11 standard, there is std::async . Pretty much anything the machine is capable of can be done in C, you just have to do it yourself.

What is synchronous and asynchronous function in C?

Synchronous means that the block is executed at the same time (though, yes, the components are executed sequentially). Asynchronous means that the block is not all executed at the same time.


2 Answers

The async/await feature was introduced in C# 5, which isn't supported by VS 2010. While the Community Technology Previews extended VS2010, I would strongly advise you to use the release version of VS 2012 instead of pre-releases. The CTPs had a few bugs, and in general it's not a good idea to use pre-release features when the RTM version is available.

Note that this isn't an Express vs Professional issue - if you upgrade from VS C# 2010 Express to VS C# 2012 Express it'll work fine.

like image 164
Jon Skeet Avatar answered Sep 23 '22 10:09

Jon Skeet


Its a new feature in 2012 and you cant use it in vs 2010.

http://msdn.microsoft.com/en-us/library/hh156513%28v=vs.110%29.aspx

like image 28
VIRA Avatar answered Sep 19 '22 10:09

VIRA