C# 8.0 has been previewed in Channel 9 by Mads Togersen. Ref: https://channel9.msdn.com/Blogs/Seth-Juarez/A-Preview-of-C-8-with-Mads-Torgersen
Top 5 tech highlights are:
1. Nullable Reference Types
Consider a scenario where you know that the nullable variable x isn’t actually null, but you can’t prove that to the compiler. In this case you can use x!.Method() to suppress the compiler warning about potential null reference exceptions.
2. Extension Everything
As with interfaces, you cannot define instance fields in extensions but you can simulate them using ConditionalWeakTable. You can also define static fields.
3. Default Interface Implementations
The primary benefit of default interface implementations is that you may be able to add new methods to an existing interface without breaking backwards compatibility.
4. Async Streams (a.k.a. foreach async)
This is referred to as a “pull model”. By contrast, IObservable
5. Extension Interfaces
Extension interfaces, the ability to add new interfaces to existing classes, is also being considered.
My closing note is C# is ahead of tech capabilities and roadmap, on comparison with Java.
No comments:
Post a Comment