It would be appreciated if C# could be updated to 9.0 from 8.0. This would benefit code golfing exercises as C# 9.0 brings top-level statements. Code can be reduced from this:
static void Main()
Currently with C# 8.0 this errors:
The feature ‘top-level statements’ is currently in Preview and unsupported. To use Preview features, use the ‘preview’ language version.csharp(CS8652)
Changes in C# 9.0
we’ve just updated the languages. See
Also, I’m not sure C# 9.0 is supported on .net core
Part of it is, but to get the full package you need to update from .Net core to .Net 5 too.
I’ve done it recently for my job, that was surprisingly easy
Yeah, it seems that C# 9.0 is not supported by .NET Core (“C# 9.0 is supported only on .NET 5 and newer versions.”). However, as Djoums said, upgrading from .NET Core to .NET 5 isn’t hard either.
Edit: it might be possible to use C# 9.0 on .NET Core, although I’m not sure if it will trigger a compiler error.
You can but it’s limited, quoting from someone else :
<LangVersion>9.0</LangVersion> with .Net Core 3.1 is possible, however there are three categories of features in C# :
- features that are entirely part of the compiler, those will work.
- features that require BCL additions. Since .Net Core is on an older BCL, those would need to be backported (for example to use init setters and records, you could import https://github.com/manuelroemer/IsExternalInit).
- features that require runtime additions, those cannot be added and won’t work (for example default interface implementations in C# 8 and covariant return types in C# 9).
Upgrading to .Net 5 is much simpler overall.
I think it’ll be part of the next update. Sorry!
Do you know when will the next update be?
We haven’t planned any update yet. That doesn’t necessarily mean we won’t do one soon, as sometimes, they’re decided last minute.
C# 10 is coming soon, too