Chris Powell

Chris is a senior solution consultant that has worked with Finance, Healthcare and other Enterprise level corporations and levels of government. Chris has over 25 years experience developing solutions for clients with many different Microsoft technologies.

Posts by Chris Powell

Primary Constructors (C# 12 Syntactic Sugar): A Guide 

With the introduction of .Net8 and C#12 in November of 2023, there were many significant changes to .NET and C#. One such feature in C#12 is the concept of a Primary Constructor. A Primary constructor replaces a class constructor with parameters on the class. The parameters for the constructor are available anywhere in the body of the class.   With Primary Constructor:  It is important to note that the class parameters are not fields of the class. The following code will not compile if used in SimpleClass, as foo and bar are not available on “this”.  Using a Primary Constructor can significantly improve the readability of your code, as it does away with a lot … Read more