DEV Community

Leandro Torres
Leandro Torres

Posted on • Edited on

.NET 6 features

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


🎯 .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


🎯 Another small improvement in .NET 6.

You can access a process path without allocation a new Process instance.

Image description


🎯 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


🎯 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


🎯 .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


🎯 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


🎯 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


🎯 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

Referências
twitter - Oleg Kyrylchuk


Até a próxima! 👊
☕😊 Agora você pode apoiar comprando um café para mim

Top comments (0)