Which version of C# am I using

Salvador Dali picture Salvador Dali · Oct 23, 2013 · Viewed 154.6k times · Source

I want to find out which version of C# I'm using. If I would be using python I would do something like python -V from the command line, or type:

import sys
print sys.version

In PHP I would do something like this: phpinfo(); in java: java -version

But I was not able to find how to achieve this in C#.

This question does not answer it, although the name suggests that it should.

I got that it depends on the .NET framework, but is there a programmatic way of figuring out my framework? I mean without going to the directory and checking the name of my .NET folders.

Answer

Praveen picture Praveen · Oct 23, 2013

It depends upon the .NET Framework that you use. Check Jon Skeet's answer about Versions.

Here is short version of his answer.

C# 1.0 released with .NET 1.0

C# 1.2 (bizarrely enough); released with .NET 1.1

C# 2.0 released with .NET 2.0

C# 3.0 released with .NET 3.5

C# 4.0 released with .NET 4

C# 5.0 released with .NET 4.5

C# 6.0 released with .NET 4.6

C# 7.0 is released with .NET 4.6.2

C# 7.3 is released with .NET 4.7.2

C# 8.0 is released with NET Core 3.0

C# 9.0 is released with NET 5.0