Question

This seems like it should be easy, but searching on the web has not turned up anything. I want to take advantage of C#'s async and await, but I have C# version 4.0.30319 (which I got from Console.Write(typeof(string).Assembly.ImageRuntimeVersion);).

I just upgraded from VS12 to VS13, and I am using .NET 4.5. I thought my C# version would upgrade as well, but it hasn't (async and await still give errors).

Any ideas?

Was it helpful?

Solution

Versioning is complex...

  • There's the version of the .NET runtime, which for you is version 4.5.
  • Then there's the version of the C# language being used, which is at least 5.0 if you're using version if you're using VS 2012 or 2013 (You are using C# 5.0 when using C# in those versions of Visual Studio, even if targeting an earlier .NET runtime , which was introduced with version 4.5 of the .NET framework.
  • Then there's the Common Language Runtime (CRL), which for you is 4.0.30319, as returned by Assembly.ImageRuntimeVersion

OTHER TIPS

What you're checking is not the version of C# - 4.0.30319 is the version of Common Language Runtime you are using (that's what Assembly.ImageRuntimeVersion means).

If you're using .NET 4.5 on Visual Studio 2013, you're already using C# 5.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top