Which features of C# 11 are you most interested in? Let me know in the comments. Source code available at: github.com/JasperKent/Required-Members Remember to subscribe at th-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html And if you liked the video, click the 👍.
The [Required] attribute applies to properties in two situations: 1) in entity class (i.e. a class that relates to a DB table), 2) in a DTO being returned from a client - e.g. in MVC. In both those cases it means a value must be provided (i.e. the property cannot be null), but it doesn't say *when* the value must be provided. The 'required' keyword says when a value must be provided - during initialization - even though the value provided may be null. In C# language terms, the [Required] attribute is more like the non-nullable concept.
Which features of C# 11 are you most interested in? Let me know in the comments.
Source code available at: github.com/JasperKent/Required-Members
Remember to subscribe at th-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html
And if you liked the video, click the 👍.
Hey, Jasper! Your videos go deep into the subject! Could you talk about "ref fields and ref scoped variables"? Thank you for sharing them! 👏👏👏
@@JoseSilva-gt6zj I'll put it on the list.
@@CodingTutorialsAreGo Thank you, Jasper! 👍
Great explanation as always!
Hello! What's difference of [required] attribute and this feature?
The [Required] attribute applies to properties in two situations: 1) in entity class (i.e. a class that relates to a DB table), 2) in a DTO being returned from a client - e.g. in MVC. In both those cases it means a value must be provided (i.e. the property cannot be null), but it doesn't say *when* the value must be provided. The 'required' keyword says when a value must be provided - during initialization - even though the value provided may be null. In C# language terms, the [Required] attribute is more like the non-nullable concept.
Great question, by the way. Enough to inspire a video answer: th-cam.com/video/bAQ93kr7mFE/w-d-xo.html
Barney Rubble!