Pro EP 58: Are you using required keyword with your properties ?
Published in
Aug 21, 2023
Since C# 11 we can add required keyword with our properties , it will force to initialize that property at the time of object creation.
There are few benefits of using it
- Less chance of error
- Get rid of validation code
- If something is essential make it required
Compiler will give error if you don’t initialize that property
Whenever you’re ready, there are 4 ways I can help you
- Subscribe to my Weekly .NET Newsletter of C#/.NET with 7000+ Software Engineers.
- Promote yourself to 7000+ subscribers by Sponsoring my Newsletter
- Download my eBook at Gum Road which contains 30+ .NET Tips (With 2800+ Downloads)
- To get 100+ free and paid resources for learning C# and .NET visit this GitHub Repository