Thursday, August 24, 2017

C# 8.0

C# 8.0 has been previewed in Channel 9 by Mads Togersen.  Ref:

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 is a “push model”, which means the producer can flood the consumer with a higher flow rate than it can handle.

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