.NET 6 features 
Tags: ptbr, dotnet, braziliandevs
Published: 2021-10-15 21:30:57

O Oleg Kyrylchuk tem feito vários posts no Twitter sobre algumas novidades do .Net 6. Vou reproduzir por aqui para registrar.


🎯 **A new configuration helper 'GetRequiredSection` has been added in .NET 6.**
>It throws an exception if a required configuration section is missing.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zdudpukjicwckwrkxal.png)
 ---

🎯 **.NET 6 introduces a new fully async 'PeriodicTimer'.**
>It's enables waiting asynchronously for timer ticks. It has one method, 'WaitForNextTickAsync', which waits for the next tick of the timer or for the timer to be stopped.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tk42su65bdvzushb9102.png)
  ---
🎯 **Another small improvement in .NET 6.**
>You can access a process path without allocation a new Process instance.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9foc3m9885s0szr85d36.png)
  ---
🎯 **Nice small improvement for ArgumentNullException in .NET 6.**
>No need to check for null in every method before throwing an exception. Now it is a one-liner.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4xqzqxppu7bgxc8zha60.png)
  ---

🎯 **New Reflection API in .NET 6 allows you to get nested nullability information.**
>You can specify that an array property must be non-null, but the elements can be null or vice versa. You can get the nullability information for the array elements.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ye014qxwc1kp3ix75l5p.png)
  ---
🎯 **.NET 6 introduces a new Reflection API for nullability information.**

>It provides nullability information and context from reflection members:
• ParameterInfo
• FieldInfo
• PropertyInfo
• EventInfo

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymjaw3bl6xkn5sr6r98m.png)
  ---

🎯 **In .NET 6, the 'JsonPropertyOrderAttribute' has been added to System.Text.Json.**
>It allows controlling the serialization order of properties. Previously, the serialization order was determined by reflection order.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nz8qav42zuzblqnoyhae.png)
  ---

🎯 **In .NET 6, System.Text.Json exposes notifications for (de)serialization.**

>There are four new interfaces to implement according to your needs:
• IJsonOnDeserialized
• IJsonOnDeserializing
• IJsonOnSerialized
• IJsonOnSerializing

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13kdamukybxgidmdvdll.png)
  ---

🎯 **In .NET 5, you can preserve references for circular references using System.Text.Json.**
>But you couldn't ignore them. The  'JsonException' is thrown if circular references have been detected. In .NET 6, you can ignore them.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb4wg8mbcaok2hr3zpal.png)
 

**Referências**
<a href="https://twitter.com/okyrylchuk" target="_blank">twitter - Oleg Kyrylchuk</a>

Até a próxima!👊
 --- 
> us Now you can support me by buying a coffee
pt Agora você pode me apoiar comprando um café
☕😊👇

<a href="https://www.buymeacoffee.com/leandroats" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>