Bite-Size C# 10 - Semi-Auto Properties and 'field' Keyword

added by DotNetKicks
8/20/2021 4:12:43 PM


The next feature in our Bite-Size C# 10 series is one that could make our classes a whole lot less cluttered: semi-auto properties, using the field keyword! In C# 9.0 and below, we have the concept of auto-implemented properties: public class Employee { public string HireDate { get; set; } } This is great, so long as you don't want to do any processing to any of these values during instantiation.