Continuing in our C# 6 Features Series…
One of the neat things about C# 6 is that it is backwards compatible to previous versions of .Net.
Language Versions are not identical to .Net Common Language Runtime (CLR) versions – which can produce a little bit of confusion. As of today (January 30, 2016), the current .Net CLR runtime is 4.6.1. The current version of the C# Language Specification is 6.
As long as you have Visual Studio 2015 installed, you can write code using the C# 6 features, then target .Net 4, and compile your application.
The only feature that isn’t available out of the box is something called IFormattableString – but that can actually be added in using something like this:
The trick is knowing what the feature does. String Interpolation, for instance, compiles down to String.Format() – and I was able to run a .Net 2 Console Application with the C# 6 String Interpolation feature.
Play around with this – let me know your results!
Other Posts In Series