6

Which version of .NET does the user have to have installed on their computer for a developer to use the updated async functionality in C# 5?

Liath
  • 9,913
  • 9
  • 51
  • 81
  • 6
    `4.5` .............. – L.B Nov 01 '12 at 15:08
  • Not an exact duplicate but this should answer your question: http://stackoverflow.com/questions/9110472/using-async-await-on-net-4 – Jude Fisher Nov 01 '12 at 15:10
  • 1
    @Ramhound: Your understanding is incorrect. It *is* C# 5. If you've got Visual Studio installed, you can find the C# 5 spec somewhere in the installation. (This has happened before - C# 3 shipped with .NET 3.5, not .NET 3.0.) – Jon Skeet Nov 01 '12 at 15:13
  • @JonSkeet - I looked at Amazon, and found `C# 5.0` books up until Aug, any search for `C# 5.0` was more very speculative hence my confusion. I had not searched for `C# 5.0` since before Aug. – Security Hound Nov 01 '12 at 15:22

2 Answers2

10

C# Async features use classes introduced in .Net 4.5

However, you can also use the Async Targetting Pack from NuGet, which includes these classes for .Net 4.0.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • 4
    Note that the Async Targeting Pack is going to be replaced shortly by [Microsoft.Bcl.Async](https://nuget.org/packages/Microsoft.Bcl.Async), which provides support for several *more* platforms. – Stephen Cleary Nov 01 '12 at 20:25
2

That depends actually. By default, only .NET 4.5 projects support async/await feature. But with Async targeting pack you can compile .NET 4 projects with Visual Studio 2012 and still use the async/await features.

You can download it from https://www.microsoft.com/en-us/download/details.aspx?id=29576. Please note that this is rather old version, a newer version is expected to be released soon. You can fetch it via NuGet from this link https://nuget.org/packages/Microsoft.Bcl.Async.

Toni Petrina
  • 7,014
  • 1
  • 25
  • 34