Bocky
Bocky

Reputation: 483

Async functions in C# using

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?

Upvotes: 7

Views: 574

Answers (4)

Marc Gravell
Marc Gravell

Reputation: 1062512

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.

Upvotes: 1

VIRA
VIRA

Reputation: 1504

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

Upvotes: 1

JohnnBlade
JohnnBlade

Reputation: 4327

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

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1499790

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.

Upvotes: 8

Related Questions