7

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?

4 Answers 4

8

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks. Actually I downloaded the VS C# 2012 Express but it requires Windows 8 to install. Is it a better idea to use delegate to do async task or the new await/async functions to do async task?
Minor clarification on naming; what used to be C# Express no longer exists; there is "... for Web", "... for Windows Desktop", "... for Windows 8", etc - and the "C# Express" maps most closely to "... for Windows Desktop". The 2012 version of "... for Windows Desktop" is not available yet.
@user1334774 see my comment above; it depends entirely on what you are trying to develop. The "... for Windows Desktop" version should be out pretty soon.
I am basically trying to asynchronously do some tasks like take a photo every hour using a kinect camera. Problem with doing it normally is that it freezes the display and I don't want that.
@user1334774 to be honest, I meant more "a windows exe", "a console exe", "an ASP.NET MVC site", etc...
1

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

Comments

1

Yes; for "Express", what you need would be one of the products in the "Visual Studio Express 2012" range; of this, "... for Web" and "... for Windows 8" are available for download, but "Visual Studio Express 2012 for Windows Desktop" is not yet available.

That keyword only exists in the C# 5 compiler.

Comments

0

Have you installed

Visual Studio Async CTP (Version 3)

http://www.microsoft.com/en-us/download/details.aspx?id=9983

and for more info http://www.codeproject.com/Articles/127291/C-5-0-vNext-New-Asynchronous-Pattern

1 Comment

I tried this but it seems that my VS is not SP1 so I can't install it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.