Why you are going to LOVE Primary Constructors in C# 12!



Why you are going to LOVE Primary Constructors in C# 12!

Why you are going to LOVE Primary Constructors in C# 12!

The first previews of C# 12 are here and one of my favorite features, which is soon to be your favorite feature is primary constructors! But, what are they? Why do you need them? How do they work? I break down all of this with a practical real world example as to why they are absolutely amazing and you will use them in every single app.

Links:
Docs – https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-12
Blog – https://devblogs.microsoft.com/dotnet/check-out-csharp-12-preview/
Code – https://github.com/jamesmontemagno/AwesomeConstructors

Chapters:
00:00 – Intro
00:35 – What are C# constructors
02:30 – Enabling C# 12 and using primary constructors
06:35 – Real world primary constructors and dependency injection
08:35 – Wrap-up

Join this channel to get access to perks:
https://www.youtube.com/channel/UCENTmbKaTphpWV2R2evVz2A/join

👕 Buy some swag! – https://jamesmontemagno.myspreadshop.com/
☕️ Buy me a coffee – https://www.buymeacoffee.com/jamesmontemagno

Follow:
👨‍💻 GitHub: https://github.com/jamesmontemagno
🦜 Twitter: https://twitter.com/jamesmontemagno
📄 Website: https://www.montemagno.com
📰 Newsletter: https://newsletter.montemagno.com/

Disclaimer: This channel, videos, and streams are created in my spare time and are a product of me… James Montemagno! They are NOT officially affiliated or endorsed by Microsoft (my employer) in any way. Opinions and views are my own.

What is on my hat? It is the CLE clothing logo because I am from Cleveland! Checkout their awesome CLE merch: https://cleclothingco.myshopify.com/

What is that art on my wall? It is an original piece from the French street artist Gregos of La Butte Montmartre: https://www.instagram.com/p/BceZ1oNHiQx/

My Setup:
📷 Canon M50 Mark II – https://amzn.to/3P8R7lp
💡 Nanoleaf Elements Lights – https://amzn.to/3umwJVW
🎙 Blue Spark Microphone – https://amzn.to/3qgtYkq
🎙 Blue Pop Filter – https://amzn.to/3jEWM3r
🤳 Rode Microphone Arm – https://amzn.to/2Z68AlE
🎧 Sony MDR7306 Headphones – https://amzn.to/372jxta
📲 Stream Deck – https://amzn.to/373Uk1n
🖱 MX Master 2S Mouse – https://amzn.to/3d7J2gj
⌨️ Tecware Phantom Keyboard – https://amzn.to/3aUP4y9

#dotnet #csharp #visualstudio #dotnetmaui #aspnetcore #csharp12 #dotnet8

Comments are closed.