News Score: Score the News, Sort the News, Rewrite the Headlines

What's New in C# 14: Null-Conditional Assignments

If you've ever developed in C#, you've likely encountered a snippet like the one below:if (config?.Settings is not null) { config.Settings.RetryPolicy = new ExponentialBackoffRetryPolicy(); }This check is necessary because, if config or config.Settings is null, a NullReferenceException is thrown when trying to set the RetryPolicy property.But no more endless ifs! The latest version of C#, scheduled for release later this year with .NET 10, introduces the null-conditional assignment operators, wh...

Read more at blog.ivankahl.com

© News Score  score the news, sort the news, rewrite the headlines