BEWARE! Async Lazy in C# Is Easy… But Is It Safe?



BEWARE! Async Lazy in C# Is Easy… But Is It Safe?

BEWARE! Async Lazy in C# Is Easy... But Is It Safe?

Now that you’re using the Lazy class in C# to handle lazy initialization the dotnet way, you’re encountering situations where you want to use async await with it. But does the Lazy class support asynchronous operations? And if it does… should we be using it? Let’s find out.

For more software engineering videos, check this out:
https://www.youtube.com/watch?v=9NIhzWDAmzE&list=PLzATctVhnsghjyegbPZOCpnctSPr_dOaF

Have you subscribed to my weekly newsletter yet? A 5-minute read every weekend, right to your inbox, so you can start your weekend learning off strong:
https://www.devleader.ca/newsletter

Check out more Dev Leader content (including full in-depth articles with source code examples) here:
https://linktr.ee/devleader

Social Media:
Blog: https://www.devleader.ca/
Newsletter: https://www.devleader.ca/newsletter
TikTok: https://www.tiktok.com/@devleader
LinkedIn: https://www.linkedin.com/in/nickcosentino
Threads: threads.net/@dev.leader
Twitter: https://twitter.com/DevLeaderCa
Facebook: https://www.facebook.com/DevLeaderCa
Instagram: https://www.instagram.com/dev.leader
GitHub: https://github.com/ncosentino/
Twitch: https://www.twitch.tv/ncosentino
YouTube: https://youtube.com/@DevLeader

#dotnet #dotnetcore #csharp #lazy #async