O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

What's New in C# 8

243 visualizações

Publicada em

With the release of C# 8, the long-awaited safe handling of null values in reference types has finally become a part of our favorite programming language. But that's not the only important new feature in this version. There's expanded support for pattern matching, asynchronous streams, default interface methods, and more. In this session, I will explain what all these features are and show you how they can be used with some sample code.

Publicada em: Tecnologia
  • You have to choose carefully. ⇒ www.HelpWriting.net ⇐ offers a professional writing service. I highly recommend them. The papers are delivered on time and customers are their first priority. This is their website: ⇒ www.HelpWriting.net ⇐
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • I'd advise you to use this service: ⇒ www.WritePaper.info ⇐ The price of your order will depend on the deadline and type of paper (e.g. bachelor, undergraduate etc). The more time you have before the deadline - the less price of the order you will have. Thus, this service offers high-quality essays at the optimal price.
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Here's the repository: https://bitbucket.org/damirarh/devdays-cs8
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • where is the demo files?
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

What's New in C# 8

  1. 1. What’s new in C# 8? Damir Arh
  2. 2. Agenda New features Nullable reference types Improvements to pattern matching Asynchronous streams Default interface members Ranges and indexes Technical requirements
  3. 3. Nullable reference types Tony Hoare: “I call it my billion-dollar mistake. It was the invention of the null reference in 1965.” Null-safety through static analysis Syntactically similar to nullable value types Requires opt-in
  4. 4. Nullable reference types DEMO
  5. 5. Nullability in existing projects Two approaches Opt-in project, opt-out files Opt-in files one by one There’s more to it: notnull generic constraint Precondition attributes Postcondition attributes Flow attributes More details: http://bit.ly/NullableAnnotations
  6. 6. Pattern matching Originally introduced in C# 7 Enhanced in C# 8 Tuple patterns Property patterns Positional patterns Switch expression
  7. 7. Pattern matching DEMO
  8. 8. Asynchronous streams Iterators: IEnumerable, IEnumerator, yield return Asynchronous methods: async, await, Task Asynchronous streams: IAsyncEnumerable, IAsyncEnumerator, yield return async, await
  9. 9. Asynchronous streams DEMO
  10. 10. Asynchronous streams in use API controller action methods in ASP.NET Core 3.0 Asynchronous query results in EF Core 3.0 LINQ methods in Ix.NET
  11. 11. Default interface members Default method implementation in interface Why? Extend interface without breaking existing implementations Trait-like composition without multiple inheritance
  12. 12. Default interface members DEMO
  13. 13. Ranges and Indexes New types: Range, Index New expression syntax for both Implicit indexer syntax for existing types
  14. 14. Ranges and indexes DEMO
  15. 15. Ranges and indexes cheat sheet array 0 1 2 3 4 5 i 0 1 2 3 4 5 Length – i ^6 ^5 ^4 ^3 ^2 ^1 [ 1..5 ) Start: inclusive End: exclusive
  16. 16. Can I use C# 8 in my project? Supported in all popular IDEs Requires .NET Standard 2.1 .NET Core 3.0+ UWP, Xamarin, Unity, Mono No support in .NET framework
  17. 17. What about class libraries? Recommended target: .NET Standard 2.0 Reasons against it: Platform-specific application model C# 8 features Nullable annotations Not available in .NET Standard 2.0 Use multi-targeting
  18. 18. Resources What’s new in C# 8.0 http://bit.ly/Cs8WhatsNew Visual C# Archives | .NET Blog http://bit.ly/DotNetBlogCSharp Language Feature Status http://bit.ly/RoslynLanguageRoadmap The Absolutely Awesome Book on C# and .NET https://www.dotnetcurry.com/csharpbook/

×