Should you use Primary Constructors in C# ? | Exploring C# and DOTNET | Rahul Nath

Published: 09 April 2024
on channel: Rahul Nath
1,726
109

Parameter Constructor is a concise syntax for declaring constructors whose parameters are available anywhere in the type's body. Beginning with C# 12, you can place any parameters after the class or struct type name.

Parameters to the Primary Constructors are in scope in the entire body of the declaring type.

Let’s explore what Primary Constructors offer us, how to use them, and some things to remember when using them.

00:00 Intro
00:23 Primary Constructors
00:47 Demo
02:15 Compiler Generated Code
02:55 Local Functions
04:40 Dependency Injection
06:36 Other Constructors
09:17 Parameters are Mutable
10:53 Compiler Generated
12:29 When to Use Primary Constructors?

🔗Primary Constructors - https://learn.microsoft.com/en-us/dot...

Additional Watching
📹 CSharp Series - https://bit.ly/mycsharp
📹 ASP Series - https://bit.ly/asp-net-core-series
📹Azure Series - https://bit.ly/azure-series
📹AWS Series - https://bit.ly/aws-net-series
📹RabbitMQ Series - https://bit.ly/rabbitmq-net-series

Come say hi! ✋
🎙️Uses - https://www.rahulpnath.com/uses
🌍Blog - https://www.rahulpnath.com/
✉ Subscribe to my Newsletter - https://www.rahulpnath.com/subscribe
🐦Twitter -   / rahulpnath  
📸Instagram -   / rahulpnath  

#dotnet #csharp


Watch video Should you use Primary Constructors in C# ? | Exploring C# and DOTNET | Rahul Nath online without registration, duration hours minute second in high quality. This video was added by user Rahul Nath 09 April 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,72 once and liked it 10 people.