C# 12 Primary Constructors
Вставка
- Опубліковано 23 лис 2023
- Getting bored of having to write code in triplicate just to initialize a field? Try primary constructors.
Source code available at:
github.com/JasperKent/Primary...
Related videos:
- C#9 Records • C# 9 Records
Topics include:
- TypeScript parameter properties
- Primary constructors in records
- Calling primary constructors
- Primary constructors in classes and structs
- Using Primary constructor fields in classes
- When not to use primary constructors
- Primary constructors and dependency injection
- Primary constructors and readonly fields
- Overloading primary constructors - Наука та технологія
You're underrated, Thank you
Do think the drawbacks of primary constructors (like missing 'readonly') outweigh the benefits? Leave a comment.
Source code available at: github.com/JasperKent/Primary-Constructors
Remember to subscribe at ua-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html
And if you liked the video, click the 👍.
At this moment primary constructors feature looks a bit unfinished, I hope they will properly implement it in the next version. Thanks for the video!
I’m finding that for other features too. Next week’s video highlights a big performance problem with the new spread operator.
This is a nice observation of these couple of C# features. Will you be doing a review of any .NET 8 or other C#12 aspects?
Oh yes. Plenty more to come.