4 ms·
We use C# 9 in our WebForms monolith and it works fine. Just add `<LangVersion>latest</LangVersion>` to your .csproj file. (This assumes you're using recent V
by nycdotnet 6y ago
We use C# 9 in our WebForms monolith and it works fine. Just add `<LangVersion>latest</LangVersion>` to your .csproj file. (This assumes you're using recent Visual Studio version and use a recent version of MSBuild as well)
- linknoid 6y agoThere are a few language features which require a specific type to be defined, but you can define those types yourself. For example, to use record syntax, you need to define this attribute: namespace System.Runtime.CompilerServices { public class IsExternalInit : Attribute { } } And supporting the new indexing syntax requires you to define System.Index and System.Range types, which are a bit more involved, but still pretty trivial: https://docs.microsoft.com/en-us/dotnet/api/system.index?view=net-5.0 https://docs.microsoft.com/en-us/dotnet/api/system.index?vie... https://docs.microsoft.com/en-us/dotnet/api/system.range?view=net-5.0 https://docs.microsoft.com/en-us/dotnet/api/system.range?vie... But pretty much all the other new C# language features I've tried have just worked straight out of the box with .NET 4.7.2.