I am working in VS2015 on a project which targets .Net framework 4.5
In the Build settings the language version is set to 'default'
As I've read, the C# 6 is only added in .Net 4.6, but I AM allowed (at least, the code compiles and runs) to use the string interpolation
feature, which I've read is a C# 6 feature.
Now I am confused: am I now compiling for C# 6 / .Net 4.6 or for .Net 4.5 (and how could I check that?)
In the comments I see that C# 6 syntax has nothing to do with the .NET framework version. I got the idea from this answer (What are the correct version numbers for C#?) where is said 'C# 6.0 released with .NET 4.6 and VS2015 (July 2015).' so I understood that C# 6 is (somehow) coupled to .NET 4.6
C# 6 features such as string interpolation are compiler features, not runtime (CLR) features. Therefore, you can use them regardless of what version of .NET you are building against, as long as your compiler supports C# 6.
In Visual Studio 2015 you can control which version of the language you are targeting in Properties
=> Build tab
=> Advanced button
=> Language Version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With