How to find out the C # version I'm using?

6

I would like to know how I can find out the C # version I am using.

    
asked by anonymous 22.03.2018 / 13:36

3 answers

8

You can check the version through code as well:

string version = typeof(string).Assembly.ImageRuntimeVersion;
  

However, from what I was analyzing, the version reported by    ImageRuntimeVersion is not the correct version of C #.

The C # version depends on which .NET Framework you are using.

  • C # 1.0 released with .NET 1.0 and VS2002
  • C # 1.2 (bizarre enough) released with .NET 1.1 and VS2003
  • C # 2.0 released with .NET 2.0 and VS2005
  • C # 3.0 released with .NET 3.5 and VS2008
  • C # 4.0 released with .NET 4 and VS2010
  • C # 5.0 released with .NET 4.5 and VS2012
  • C # 6.0 released with .NET 4.6 and VS2015
  • C # 7.0 released with .NET 4.6.2 and VS2017
  • C # 7.1 released with VS2017 v15.3
  • C # 7.2 released with VS2017 v15.5

The C # Language Team has created a history of the C # versions and their features in the github pository of them:

Information taken from:

22.03.2018 / 13:40
4

As far as I know, there is no information at runtime, you can only get the framework .

The Compiler tells its version to call on the command line. But it does not say what language version, because it can compiler with a different version profile. You can at least know what version it compiles to.

Try to do this in the project:

If none of this works, and you have to give it, try using a feature that only has one version, if it works, you know that at least that version is ok. If you know the error, it has a lower version, there goes in the attempt and error up or down :) I know it's gambi, but it's the way if nothing else works out.

    
23.03.2018 / 12:16
4
  • Right-click the project file (usually a csproj)
  • Properties
  • Build
  • Advanced
  • In the general section you have language version

    
22.03.2018 / 13:39